Coverage Report - org.jtheque.films.view.impl.actions.lendings.AcReturnCurrentFilm
 
Classes in this File Line Coverage Branch Coverage Complexity
AcReturnCurrentFilm
0 %
0/10
0 %
0/4
2
 
 1  
 package org.jtheque.films.view.impl.actions.lendings;
 2  
 
 3  
 /*
 4  
  * This file is part of JTheque.
 5  
  *
 6  
  * JTheque is free software: you can redistribute it and/or modify
 7  
  * it under the terms of the GNU General Public License as published by
 8  
  * the Free Software Foundation, either version 3 of the License.
 9  
  *
 10  
  * JTheque is distributed in the hope that it will be useful,
 11  
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
 12  
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 13  
  * GNU General Public License for more details.
 14  
  *
 15  
  * You should have received a copy of the GNU General Public License
 16  
  * along with JTheque.  If not, see <http://www.gnu.org/licenses/>.
 17  
  */
 18  
 
 19  
 import org.jtheque.core.managers.Managers;
 20  
 import org.jtheque.core.managers.beans.IBeansManager;
 21  
 import org.jtheque.core.managers.view.able.IViewManager;
 22  
 import org.jtheque.core.managers.view.impl.actions.JThequeAction;
 23  
 import org.jtheque.films.controllers.able.ILendingsController;
 24  
 import org.jtheque.films.view.able.ILendingsView;
 25  
 
 26  
 import java.awt.event.ActionEvent;
 27  
 import java.util.Collection;
 28  
 
 29  
 /**
 30  
  * Action to return the current film.
 31  
  *
 32  
  * @author Baptiste Wicht
 33  
  */
 34  
 public final class AcReturnCurrentFilm extends JThequeAction {
 35  
     /**
 36  
      * Construct a new AcReturnCurrentFilm.
 37  
      */
 38  
     public AcReturnCurrentFilm() {
 39  0
         super("lendings.view.actions.return");
 40  0
     }
 41  
 
 42  
     @Override
 43  
     public void actionPerformed(ActionEvent e) {
 44  0
         ILendingsController lendingsController = Managers.getManager(IBeansManager.class).getBean("lendingsController");
 45  
         
 46  0
         ILendingsView view = (ILendingsView) lendingsController.getView();
 47  
 
 48  0
         Collection<Integer> ids = view.getSelectedLendingsID();
 49  
 
 50  0
         if (ids.isEmpty()) {
 51  0
             Managers.getManager(IViewManager.class).displayI18nText("lendings.dialogs.selectLending");
 52  
         } else {
 53  0
             for (int id : ids) {
 54  0
                 lendingsController.deleteLending(id);
 55  
             }
 56  
         }
 57  0
     }
 58  
 }