bodhidharma
Class FeaturesPanel

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.FeaturesPanel
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 FeaturesPanel
extends javax.swing.JPanel
implements java.awt.event.ActionListener

Part of the Bodhidharma automatic music classification project. This is the panel of the GUI that allows users to see the available features and choose which ones are to be extracted from recordings, which ones are to be candidates for use in classification during feature selection and whiether or not individual features are to be used for classification in overide mode.

This class does not extract or store actual feature values. These are both done by the RecordingsPanel class. Objects of the RecordingsPanel class do, however, access the feature_settings field of this class in order to determine which features to extract.

The table displays all available features. These may be sorted be clicking on the column heading that one wishes to base the search on. A user may also see a description of a feature by double clicking on it. The user may change the extract, selection candidate and overide status of a feature by clicking on an appropriate check box.

Important: It should be noted that the table on this panel displays ALL available features, not just the ones that may be loaded and saved on features_file XML files. These files simply load the values of the check boxes for features. Features not mentioned in these files are simply set to defaults. The actual features available are hardwired into the software.

It is also important to note that actual feature values are not stored in objects of this class. They can be found in the feature_set field of each Recording object in the recordings_list field of the Recording panel.

The Extract setting controls whether or not a feature is to be extracted from recordings the next time that an extraction is performed. The Selection Candidate setting controls whether a feature is to be considered during feature selection. The Overide Status setting controls whether or not a feature is used for classification in overide classifications, which is to say in classifications where feature selection is not performed and the features given overide status (and only these features) are used for classification.

The Code column gives the code of each feature. The Name column gives the name of each feature. The Type column states whether the feature is one-dimensional or multi-dimensional.

The View Descriptions button gives a brief description of all features that are highlighted.

The Load Features button loads a features_file XML file into memory and displays it.

The Save Features button saves the current contents of the feature_settings field into the path referred to in the ConfigureFileLocationsJFrame dialog box. The Save As button allows the user to choose the path to which the file is to be saved and updates the path in the ConfigureFileLocationsJFrame dialog box.

The getFeatureSettings method can be called by other objects to access the feature settings stored in objects of this class.

The saveFeaturesSettingsFile method can be called by other objects to save the contents of the feature_settings field into the path referred to in the ConfigureFileLocationsJFrame dialog box.

See Also:
ConfigureFileLocationsJFrame, MainJFrame, XMLDocumentParser, ParseFeaturesFileHandler, JTable, FeaturesTableModel, 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
 
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
FeaturesPanel(MainJFrame parent)
          Basic constructor.
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent event)
          Calls the appropriate methods when the buttons are pressed.
 void addTableMouseListener()
          If a column table is clicked on, this method sorts the display as well as the feature_settings based on the column title that a user clicks on.
 FeatureSettings[] getFeatureSettings()
          Retuan feature_settings after ensuring that it has been updated to include any changes entered on the table.
 void saveFeaturesSettingsFile(java.lang.String comments, boolean is_basic_save)
          Saves a features_file XML file with the contents specified in the feature_settings field and the comments specified in the comments parameter.
 
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
 

Constructor Detail

FeaturesPanel

public FeaturesPanel(MainJFrame parent)
Basic constructor. Configures the panel and loads the feature settings specified in the features_file XML file specified in the ConfigureFileLocationsJFrame object. Creates new feature_settings if a valid features file is not specified or if the specified features_file is invalid.

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

getFeatureSettings

public FeatureSettings[] getFeatureSettings()
Retuan feature_settings after ensuring that it has been updated to include any changes entered on the table.

Returns:
the contents of feature_settings

saveFeaturesSettingsFile

public void saveFeaturesSettingsFile(java.lang.String comments,
                                     boolean is_basic_save)
Saves a features_file XML file with the contents specified in the feature_settings 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 features_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.

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

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.

addTableMouseListener

public void addTableMouseListener()
If a column table is clicked on, this method sorts the display as well as the feature_settings based on the column title that a user clicks on.

If a row is double clicked on, brings up a description of the corresponding feature.