bodhidharma
Class RecordingsPanel

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by javax.swing.JPanel
                  extended by bodhidharma.utilities.ProcessResultsReceiver
                      extended by bodhidharma.RecordingsPanel
All Implemented Interfaces:
java.awt.event.ActionListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, java.util.EventListener, javax.accessibility.Accessible

public class RecordingsPanel
extends ProcessResultsReceiver
implements java.awt.event.ActionListener

Part of the Bodhidharma automatic music classification project. Allows the user to create, view and edit lists of recordings, listen to recordings, edit the names and model categories of recordings and extract features from recordings. Holds the recordings_list field which can be accessed by other objects in order to gain information about what recordings are currently loaded and their characteristics and feature values. The recordings in the list are the ones that will be used for training and/or testing.

There are three possible views available in this JPanel. The user may move between them by pressing on the Display Recordings Info, Display Feature Values and Display Scaled Feature Values buttons. The first view is described in the following paragraphs. The second view is only available if featuers have been extracted from at least one of the loaded recordings. This second view displays the values of all features that have been extracted from the loaded recordings. Multi-dimensional features are marked "MD" in this table. Double clicking on the MD for a particular recording will bring up a window displaying each dimension of the feature of the selected recording. Individual features that have not been extracted for a given recording are marked "--". No buttons are available in this view other than the other two display buttons. The third view is also only available if features have been extracted from the loaded recordings, and a trained one-dimensional classifier with calculated scaling parameters must also be loaded. This third view displays the scaled values of the one-dimensional (only) features for each recording as well as the minimum and maximum value cutoffs for each feature, as defined by the classifier. The following paragraphs discuss the view and options related to the view brought up by pressing the Display Recordings Info button.

The table displayes the Title, Artist, File Name, Leaf Categories, Ancestor Categories and roles of each recording. The column widths can be adjusted by clicking on the column borders and dragging. The recordings may be sorted based on the contents of any column by clicking on the appropriate column header.

The contents of any particular recording or recordings may be viewed in greater detail and/or edited by selecting the appropriate row(s) and clicking on the Edit Selections button. Double clicking on a single row has the equivalent effect. In either case, an EditRecordingJFrame dialog box will be brought up for each of the selected recordings. This will allow the user to view the recording in more detail and change its title, artist, role and model category fields. The role of a recording may also be changed by clicking on the appropriate row under the Role column and selecting the desired Role from the resultant combo box.

Recordings may be deleted by selecting the appropriate rows and clicking on the Delete Selections button. A new recording may also be added by clicking on the Add New Recording button. This will bring up a JFileChooser dialog box that will allow the user to choose the appropriate file. It should be noted that the JFileChooser dialog box only displays files of the appropriate recording type that are not currently in the list. All recordings must be in the same directory, so if at least one recording is loaded, then the user will only be permitted to see files in that directory. Multiple files may be chosen from this dialog box to be added at once. A EditRecordingJFrame dialog box will then be brought up to allow the user to configure each new recording's meta-data.

Features are NOT automatically extracted from a recording when it is added by pressing the Add New Recordings button. In order to extract features, one must press the Extract Features button. This will bring up a ProgressBarDialog that will extract the features marked for extraction in the feature_settings field of the FeaturesPanel from all currently loaded recordings that have not already had these features extracted. The user may cancel the extraction at any time by pressing on the ProgressBarDialog's Cancel button at any time, but none of the extracted features will be recorded if this is done. When extraction is complete the user has the option of pressing the ProgressBarDialog's Accept button. This will cause all the extracted features to be saved in the recordings_list field. It will also cause the system to cycle through ALL loaded recordings ane delete any features that were extracted previously but are not currently marked for extraction in the feature_settings field of the FeaturesPanel. Pressing the Accept button also causes all recordings that could not have features extracted from them due to some error (which will have been reported in the Errors Encountered area of the ProgressBarDialog) to be deleted from the recordings_list field.

Pressing on the Forget Extracted Features button will cause the system to erase all extracted feature values from the recordings_list field.

A new set of recordings can be loaded from a recordings_list file by clicking on the Load Recordings List button. This will erase the currently loaded recordings list, if any, and replace it with the contents of this file. Unspecified genres, titles or artists will be displayed as "Unknown". Note that recordings_list files only include leaf categories, and that the contents of the Ancestor Categories column are dynamically generated, and depond on the contents of the taxonomy field of the TaxonomyPanel. Upon loading a recordings_list file, the system checks to see if a feature_values_file file containing feature values for the recordings in the recordings_list file is available, and loads it if it is. This file is always in the same directory and has the same name as the recordings_list file, but with the string "_feature_values" appended to the end of the file name.

Note that it is also possible to load tab delimited text files in the MIREX 2005 format that hold recording lists as an alternative to the XML files. This functionality is intended primarily for use with the command line use of Bodhidharma.

The Verify Files button causes the system to check that all of the files referred to in the list of recordings actually exist. A report window is generated ro report any problems encountered.

IMPORTANT: alll recordings files referred to in a recordings_list file or added to the list with the Add New Recording button must be in the same folder. It is for this reason that the JFileChooser dialog box does not display directories unless no recordings are currently in the list. If the user wishes to move the recordings to a different directory, then s/he must press on the Change Recordings Path button and select the new directory where all recordings referred to in the recordings_list field can be found.

The current contents of the recordings_list field can be saved using the Save Recordings List or Save Recordings List As buttons. If features have been extracted for the recordings in the recordings_list field, then a feature_values_file file containing feature values for the recordings is also saved. This file is saved in the same directory and has the same name as the recordings_list file, but with the string "_feature_values" appended to the end of the file name. Features are only saved for recordings that have had features extracted from them and no checking is performed to see if all recordings have the same features extracted from them.

The New Recordings List button erases the current list of recordings and replaces it with a blank list to which new recordings can be added.

Statistics on the categories of the loaded recordings can be seen by pressing on the Display Category Count button. This generates a window showing the number of recordings falling into each category. Categories are divided into three groups: leaf categories, parent categories (i.e. categories at the highest level of the taxonomy) and middle categories (i.e. categoriesthat are neither leaves nor parent categories. The categories in each of these groups are sorted alphabetically. The number of recordings which have not been assigned model categories is also reported, as are the sum of leaf categories beyond the first for each recording and the number of recordings in all.

The Classify Selections button classifies the highlighted recordings and switches to the ClassificationPanel to show the results. Replaces any stored test recordings ClassificationPanel with the selected recordings. Any model categories are ignored. Note that the recordings that are classified are the ones that are highlighted, and that the role field has no effect.

The saveRecordingsFile method can be called to save the contents of the recordings_list field in a recordings_list file and a feature_values_file file.

The displayRecordingsTable method can be called to update the displayed table of recordings, the status bar and which buttons are enabled.

The updateAfterAddedRecording method can be called to update the recordings_list field and the display to reflect the addition of a new recording.

The acceptProcessingResults method can be called to cause the system to reflect the results of feature extraction performed by a ProgressBarTaskFeatureExtractionMonitor.

The newRecordingsList method can be called to clear the recordings_list field and update the display.

See Also:
ProcessResultsReceiver, ConfigureFileLocationsJFrame, MainJFrame, XMLDocumentParser, ParseRecordingsFileHandler, ProgressBarTaskFeatureExtractionMonitor, ProgressBarTaskMonitor, ProgressBarDialog, JTable, RecordingsTableModel, Recording, FeatureSet, FeatureSettings, Serialized Form
Author:
Cory McKay

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.JPanel
javax.swing.JPanel.AccessibleJPanel
 
Nested classes/interfaces inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
Nested classes/interfaces inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
 javax.swing.JButton extract_features_button
           
 boolean features_extracted
          Indicates whether features (of any kind) have been extracted from recordings in recordings_list
 ProgressBarTaskFeatureExtractionMonitor monitor_extractor
          Monitors feature extraction and holds results temporarily until acknowledged by user
 MainJFrame parent_window
          Window that holds this JPanel
 ProgressBarDialog progress_indicator
          Dialog box displaying status of feature extraction.
 Recording[] recordings_list
          The array of recordings to be used for testing, training and/or classification.
 
Fields inherited from class javax.swing.JComponent
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
RecordingsPanel(MainJFrame parent)
          Basic constructor.
 
Method Summary
 void acceptProcessingResults()
          Make the results of parsing be implemented.
 void actionPerformed(java.awt.event.ActionEvent event)
          Calls the appropriate methods when the buttons are pressed.
 void addFeatureValueTableMouseListener()
          Causes a dialog box to appear listing the values of a multi-dimensional feature of a recording if the user double clicks on a cell shown in recordings_table marked MD.
 void addRecordingsTableMouseListener()
          Causes edit dialog to appear if double click on a recording.
 void displayRecordingsTable()
          Updates the table and the status bar to reflect the contents of recordings_list.
 Recording[] getRecordingsMarkedForClassification()
          Returns the recordings marked with a role of classification.
 Recording[] getRecordingsMarkedForTesting()
          Returns the recordings marked with a role of testing.
 void newRecordingsList()
          Reset everything and clear screen and deactivate appropriate buttons.
 void saveFeatureValues()
          Saves the currently stored feature values for the currently loaded set or recordings.
 void saveRecordingsFile(java.lang.String comments, boolean is_basic_save)
          Saves a recordings_file XML file with the contents specified in the recordings_list field and the comments specified in the comments parameter.
 void updateAfterAddedRecording(Recording new_recording)
          Updates the recordings_list and the display to reflect the addition of the new recording specified in the parameter of this method.
 void updateRoles()
          Read the roles from the table and update training_list.
 
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusBackward, transferFocusDownCycle, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

recordings_list

public Recording[] recordings_list
The array of recordings to be used for testing, training and/or classification.


parent_window

public MainJFrame parent_window
Window that holds this JPanel


features_extracted

public boolean features_extracted
Indicates whether features (of any kind) have been extracted from recordings in recordings_list


monitor_extractor

public ProgressBarTaskFeatureExtractionMonitor monitor_extractor
Monitors feature extraction and holds results temporarily until acknowledged by user


progress_indicator

public ProgressBarDialog progress_indicator
Dialog box displaying status of feature extraction.


extract_features_button

public javax.swing.JButton extract_features_button
Constructor Detail

RecordingsPanel

public RecordingsPanel(MainJFrame parent)
Basic constructor. Configures the panel and loads the recordings specified in the recordings_file XML file specified in the ConfigureFileLocationsJFrame object. Creates a new empty recordings list if a valid taxonomy file is not specified there or if the specified recordings_file is invalid or contains categories not in the currently loaded taxonomy.

Parameters:
parent - Name of the MainJFrame window that holds this panel.
See Also:
ConfigureFileLocationsJFrame, MainJFrame
Method Detail

actionPerformed

public void actionPerformed(java.awt.event.ActionEvent event)
Calls the appropriate methods when the buttons are pressed.

Specified by:
actionPerformed in interface java.awt.event.ActionListener
Parameters:
event - The event that is to be reacted to.

addRecordingsTableMouseListener

public void addRecordingsTableMouseListener()
Causes edit dialog to appear if double click on a recording. Also enables sorting by clicking on a column heading.


addFeatureValueTableMouseListener

public void addFeatureValueTableMouseListener()
Causes a dialog box to appear listing the values of a multi-dimensional feature of a recording if the user double clicks on a cell shown in recordings_table marked MD.


saveRecordingsFile

public void saveRecordingsFile(java.lang.String comments,
                               boolean is_basic_save)
Saves a recordings_file XML file with the contents specified in the recordings_list field and the comments specified in the comments parameter.

If the is_basic_save parameter is true, then the file is saved at the path specified in the ConfigureFileLocationsJFrame object's recordings_list_path field (automatically overwriting any existing files with the same path). If the is_basic_save parameter is false, then the file is saved at a location chosen by the user with a JFileChooser dialog box.

Also, if feature values are available for the currently loaded recordings then, calls a private method to save the feature values in a separate file. These are stored in a feature_values_file XML file in the same directory as the currently loaded recordings_file. The name of the file is the same as that of the recordings_file, but with "_feature_values" appended to the end of the file name. Features are only stored for recordings that have had features extracted from them. No checking is performed to see if all recordings have the same features extracted from them.

Parameters:
comments - Any comments to be saved inside the comments element of the XML file.
is_basic_save - Whether this is a save (true) or save as (false) operation.
See Also:
ConfigureFileLocationsJFrame

getRecordingsMarkedForClassification

public Recording[] getRecordingsMarkedForClassification()
Returns the recordings marked with a role of classification. Returns null if there are no recordings marked in this fashion.


getRecordingsMarkedForTesting

public Recording[] getRecordingsMarkedForTesting()
Returns the recordings marked with a role of testing. Returns null if there are no recordings marked in this fashion.


updateRoles

public void updateRoles()
Read the roles from the table and update training_list.


displayRecordingsTable

public void displayRecordingsTable()
Updates the table and the status bar to reflect the contents of recordings_list. Updates which buttons are enabled.


updateAfterAddedRecording

public void updateAfterAddedRecording(Recording new_recording)
Updates the recordings_list and the display to reflect the addition of the new recording specified in the parameter of this method.

Parameters:
new_recording - The new recording to add to recordings_list.
See Also:
Recording

acceptProcessingResults

public void acceptProcessingResults()
Make the results of parsing be implemented. Triggered by the user pressing the Accept button on a ProgressBarDialog window.

Cycles through all recordings that were not marked to have features extracted and deletes any unrequired features in them. Also deletes any recordings from the recordings_list field that could not be extracted due to an error. and updates the display. Also stores the new features in recordings_list.

Specified by:
acceptProcessingResults in class ProcessResultsReceiver

newRecordingsList

public void newRecordingsList()
Reset everything and clear screen and deactivate appropriate buttons. Reset the stored recording list file path to blank.


saveFeatureValues

public void saveFeatureValues()
Saves the currently stored feature values for the currently loaded set or recordings. These are stored in a feature_values_file XML file in the same directory as the currently loaded recordings_file. The name of the file is the same as that of the recordings_file, but with "_feature_values" appended to the end of the file name. Features are only stored for recordings that have had features extracted from them. No checking is performed to see if all recordings have the same features extracted from them.