Coverage Report - org.jtheque.films.view.impl.actions.lendings.AcRetourCurrentFilm
 
Classes in this File Line Coverage Branch Coverage Complexity
AcRetourCurrentFilm
0 %
0/9
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.view.impl.actions.JThequeAction;
 21  
 import org.jtheque.core.managers.view.IViewManager;
 22  
 import org.jtheque.films.controllers.able.ILendingsController;
 23  
 import org.jtheque.films.view.able.ILendingsView;
 24  
 
 25  
 import javax.annotation.Resource;
 26  
 
 27  
 import java.awt.event.ActionEvent;
 28  
 import java.util.List;
 29  
 
 30  
 /**
 31  
  * Action to return the current film.
 32  
  *
 33  
  * @author Baptiste Wicht
 34  
  */
 35  
 public final class AcRetourCurrentFilm extends JThequeAction {
 36  
     private static final long serialVersionUID = 1235248610981426905L;
 37  
 
 38  
     @Resource
 39  
     private ILendingsController lendingsController;
 40  
 
 41  
     /**
 42  
      * Construct a new AcRetourCurrentFilm.
 43  
      */
 44  
     public AcRetourCurrentFilm() {
 45  0
         super("lendings.view.actions.return");
 46  0
     }
 47  
 
 48  
     @Override
 49  
     public void actionPerformed(ActionEvent e) {
 50  0
         ILendingsView view = (ILendingsView) lendingsController.getView();
 51  
 
 52  0
         List<Integer> ids = view.getSelectedLendingsID();
 53  
 
 54  0
         if (ids.isEmpty()) {
 55  0
             Managers.getManager(IViewManager.class).displayI18nText("lendings.dialogs.selectLending");
 56  
         } else {
 57  0
             for (int id : ids) {
 58  0
                 lendingsController.deleteLending(id);
 59  
             }
 60  
         }
 61  0
     }
 62  
 }