Coverage Report - org.jtheque.films.view.impl.actions.film.AcExportFilm
 
Classes in this File Line Coverage Branch Coverage Complexity
AcExportFilm
0 %
0/8
0 %
0/2
1.5
 
 1  
 package org.jtheque.films.view.impl.actions.film;
 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.IExportController;
 24  
 import org.jtheque.films.controllers.able.IFilmController;
 25  
 import org.jtheque.utils.StringUtils;
 26  
 import org.jtheque.utils.io.SimpleFilter;
 27  
 
 28  
 import javax.annotation.Resource;
 29  
 import java.awt.event.ActionEvent;
 30  
 
 31  
 /**
 32  
  * Action to export a film.
 33  
  *
 34  
  * @author Baptiste Wicht
 35  
  */
 36  
 public final class AcExportFilm extends JThequeAction {
 37  0
     private final SimpleFilter jTFFilter = new SimpleFilter("Files JTF(*.jtf)", ".jtf");
 38  
 
 39  
     @Resource
 40  
     private IFilmController filmController;
 41  
 
 42  
     @Resource
 43  
     private IExportController exportController;
 44  
 
 45  
     /**
 46  
      * Construct a new AcExportFilm.
 47  
      */
 48  
     public AcExportFilm() {
 49  0
         super("film.view.actions.export");
 50  
         
 51  0
         Managers.getManager(IBeansManager.class).inject(this);
 52  0
     }
 53  
 
 54  
     @Override
 55  
     public void actionPerformed(ActionEvent actionevent) {
 56  0
         String filePath = Managers.getManager(IViewManager.class).chooseFile(jTFFilter);
 57  
 
 58  0
         if (StringUtils.isNotEmpty(filePath)) {
 59  0
             exportController.exportFilm(filePath, filmController.getViewModel().getCurrentFilm());
 60  
         }
 61  0
     }
 62  
 }