1 /* 2 * aTunes 3 * Copyright (C) Alex Aranda, Sylvain Gaudard and contributors 4 * 5 * See http://www.atunes.org/wiki/index.php?title=Contributing for information about contributors 6 * 7 * http://www.atunes.org 8 * http://sourceforge.net/projects/atunes 9 * 10 * This program is free software; you can redistribute it and/or 11 * modify it under the terms of the GNU General Public License 12 * as published by the Free Software Foundation; either version 2 13 * of the License, or (at your option) any later version. 14 * 15 * This program is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU General Public License for more details. 19 */ 20 21 package net.sourceforge.atunes.kernel.modules.covernavigator; 22 23 import java.awt.event.ActionEvent; 24 import java.awt.event.ActionListener; 25 26 import net.sourceforge.atunes.gui.views.dialogs.CoverNavigatorDialog; 27 import net.sourceforge.atunes.kernel.modules.process.GetCoversProcess; 28 import net.sourceforge.atunes.model.IArtist; 29 import net.sourceforge.atunes.model.IProcessFactory; 30 31 final class GetCoversButtonActionListener implements ActionListener { 32 33 private final CoverNavigatorController controller; 34 35 private final IProcessFactory processFactory; 36 37 private final CoverNavigatorDialog frame; 38 39 /** 40 * @param controller 41 * @param processFactory 42 * @param frame 43 */ GetCoversButtonActionListener(CoverNavigatorController controller, IProcessFactory processFactory, CoverNavigatorDialog frame)44 GetCoversButtonActionListener(CoverNavigatorController controller, IProcessFactory processFactory, CoverNavigatorDialog frame) { 45 this.controller = controller; 46 this.processFactory = processFactory; 47 this.frame = frame; 48 } 49 50 @Override actionPerformed(ActionEvent e)51 public void actionPerformed(ActionEvent e) { 52 IArtist selectedArtist = (IArtist) frame.getList().getSelectedValue(); 53 if (selectedArtist != null) { 54 GetCoversProcess process = (GetCoversProcess) processFactory.getProcessByName("getCoversProcess"); 55 process.setArtist(selectedArtist); 56 process.addProcessListener(new GetCoversProcessListener(controller)); 57 process.execute(); 58 } 59 } 60 }