Skip to content

Commit

Permalink
Fix play matched track
Browse files Browse the repository at this point in the history
  • Loading branch information
Borewit committed Mar 31, 2023
1 parent 65c5aaa commit 9861d60
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 45 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package listfix.view.controls;

import listfix.model.BatchMatchItem;
import listfix.model.playlists.FilePlaylistEntry;
import listfix.model.playlists.PotentialPlaylistEntryMatch;
import listfix.view.support.ZebraJTable;
import org.apache.logging.log4j.LogManager;
Expand Down Expand Up @@ -33,9 +32,7 @@ public class ClosestMatchesSearchScrollableResultsPanel extends JPanel

public ClosestMatchesSearchScrollableResultsPanel()
{
_items = new ArrayList<>();
initComponents();
initialize();
this(new ArrayList<>());
}

/**
Expand Down Expand Up @@ -219,8 +216,7 @@ public void actionPerformed(ActionEvent e)

try
{
// ToDo match.getTrack().play(match.getPlaylistOptions());
throw new UnsupportedOperationException("ToDo");
Desktop.getDesktop().open(match.getTrack().toFile());
}
catch (Exception ex)
{
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/listfix/view/controls/PlaylistEditCtrl.java
Original file line number Diff line number Diff line change
Expand Up @@ -439,7 +439,7 @@ private void findClosestMatches(ProgressWorker<List<BatchMatchItem>, String> wor
List<Integer> fixed = _playlist.applyClosestMatchSelections(items);
for (Integer fixIx : fixed)
{
int viewIx = _uiTable.convertRowIndexToView(fixIx.intValue());
int viewIx = _uiTable.convertRowIndexToView(fixIx);
_uiTable.addRowSelectionInterval(viewIx, viewIx);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,19 @@
import javax.swing.*;
import javax.swing.table.TableCellEditor;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.List;

/**
* This is the results dialog we display when running a closest matches search on multiple files in a playlist (this operation originally worked only on a single entry)..
*/
public class BatchClosestMatchResultsDialog extends JDialog
{
private final List<BatchMatchItem> _items;

public BatchClosestMatchResultsDialog(Frame parent, List<BatchMatchItem> items)
{
super(parent, true);
_items = items;
this._items = items;
initComponents();

// get screenwidth using workaround for vmware/linux bug
Expand Down Expand Up @@ -49,22 +49,19 @@ public List<BatchMatchItem> getMatches()
return _items;
}

private final List<BatchMatchItem> _items;

/**
* This method is called from within the constructor to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
* always regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents()
{

jPanel1 = new JPanel();
_btnOk = new JButton();
_btnCancel = new JButton();
JPanel jPanel1 = new JPanel();
JButton _btnOk = new JButton();
// Variables declaration - do not modify//GEN-BEGIN:variables
JButton _btnCancel = new JButton();
_pnlResults = new ClosestMatchesSearchScrollableResultsPanel(_items);

setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
Expand All @@ -73,55 +70,36 @@ private void initComponents()
jPanel1.setLayout(new FlowLayout(FlowLayout.RIGHT));

_btnOk.setText("OK");
_btnOk.addActionListener(new ActionListener()
{
@Override
public void actionPerformed(ActionEvent evt)
{
onBtnOkActionPerformed();
}
});
_btnOk.addActionListener(evt -> onBtnOkActionPerformed());
jPanel1.add(_btnOk);

_btnCancel.setText("Cancel");
_btnCancel.addActionListener(new ActionListener()
{
@Override
public void actionPerformed(ActionEvent evt)
{
onBtnCancelActionPerformed();
}
});
_btnCancel.addActionListener(evt -> onBtnCancelActionPerformed());
jPanel1.add(_btnCancel);

getContentPane().add(jPanel1, BorderLayout.SOUTH);
getContentPane().add(_pnlResults, BorderLayout.CENTER);

pack();
}// </editor-fold>//GEN-END:initComponents
}

private void onBtnOkActionPerformed()//GEN-FIRST:event_onBtnOkActionPerformed
{//GEN-HEADEREND:event_onBtnOkActionPerformed
private void onBtnOkActionPerformed()
{
_isAccepted = true;
if (_pnlResults.getSelectedRow() > -1 && _pnlResults.getSelectedColumn() == 3)
{
TableCellEditor cellEditor = _pnlResults.getCellEditor(_pnlResults.getSelectedRow(), _pnlResults.getSelectedColumn());
cellEditor.stopCellEditing();
}
setVisible(false);
}//GEN-LAST:event_onBtnOkActionPerformed
}

private void onBtnCancelActionPerformed()//GEN-FIRST:event_onBtnCancelActionPerformed
{//GEN-HEADEREND:event_onBtnCancelActionPerformed
private void onBtnCancelActionPerformed()
{
_isAccepted = false;
setVisible(false);
}//GEN-LAST:event_onBtnCancelActionPerformed
}

// Variables declaration - do not modify//GEN-BEGIN:variables
private JButton _btnCancel;
private JButton _btnOk;
private ClosestMatchesSearchScrollableResultsPanel _pnlResults;
private JPanel jPanel1;
// End of variables declaration//GEN-END:variables

}

0 comments on commit 9861d60

Please sign in to comment.