@@ -30,6 +30,7 @@ public class ProgramWindow {
3030 private final JPanel cdSearchPanel = new JPanel ();
3131 private final JLabel searchStatusLabel = new JLabel ("Status: Nothing's going on." );
3232 private static final ArrayList <String > idList = new ArrayList <>();
33+ private final MusicBrainzLabelGenerator labelGenerator = new MusicBrainzLabelGenerator ();
3334
3435 /**
3536 * Creates a new ProgramWindow and sets up the GUI.
@@ -402,10 +403,11 @@ private void clickSearch(int row, int col, JTable table) {
402403 if (col == 0 ) {
403404 response = sendRequest (typeOfTable .equals ("Disc Name" ) ? "tracks" : "release" , idList .get (row ), true );
404405 MusicBrainzJSONReader reader = new MusicBrainzJSONReader (response );
405- model = reader .getTracksAsTableModel (typeOfTable .equals ("Disc Name" ) ? reader .getTracks () : reader .getReleaseTracks ());
406+ MusicBrainzTrack [] tracks = typeOfTable .equals ("Disc Name" ) ? reader .getTracks () : reader .getReleaseTracks ();
407+ model = reader .getTracksAsTableModel (tracks );
406408 String date = typeOfTable .equals ("Release Name" ) ? table .getValueAt (row , 3 ).toString () : null ;
407409 createTrackDialog (table .getValueAt (row , 0 ).toString (), table .getValueAt (row , 1 ).toString (),
408- Integer .parseInt (table .getValueAt (row , 2 ).toString ()), date , model );
410+ Integer .parseInt (table .getValueAt (row , 2 ).toString ()), date , model , tracks );
409411 } else if (col == 1 ) {
410412 response = sendRequest ("artist" , table .getValueAt (row , 1 ).toString (), false );
411413 MusicBrainzJSONReader reader = new MusicBrainzJSONReader (response );
@@ -428,7 +430,7 @@ private void clickSearch(int row, int col, JTable table) {
428430 * @param date The date of the release. CDStubs typically do not have a date.
429431 * @param model The table model to use for the track list.
430432 */
431- private void createTrackDialog (String title , String artist , int trackCount , String date , DefaultTableModel model ) {
433+ private void createTrackDialog (String title , String artist , int trackCount , String date , DefaultTableModel model , MusicBrainzTrack [] tracks ) {
432434 // Set up panels
433435 JPanel mainPanel = new JPanel (new BorderLayout ());
434436 JPanel panel = new JPanel ();
@@ -455,7 +457,7 @@ private void createTrackDialog(String title, String artist, int trackCount, Stri
455457 // Show dialog
456458 int result = JOptionPane .showConfirmDialog (null , mainPanel , "Tracks" , JOptionPane .YES_NO_OPTION );
457459 if (result == JOptionPane .YES_OPTION ) {
458- System . out . println ( "ask her out" );
460+ labelGenerator . addRelease ( new MusicBrainzFinalizedRelease ( title , artist , tracks ) );
459461 } else if (result == JOptionPane .NO_OPTION ) {
460462 System .out .println ("she rejected you..." );
461463 }
0 commit comments