Coverage Report - org.jtheque.films.view.impl.actions.file.AcValidateExportView
 
Classes in this File Line Coverage Branch Coverage Complexity
AcValidateExportView
0 %
0/5
0 %
0/2
1.2
AcValidateExportView$1
N/A
N/A
1.2
AcValidateExportView$ExportTask
0 %
0/5
N/A
1.2
AcValidateExportView$ExportTask$1
0 %
0/5
N/A
1.2
AcValidateExportView$ExportTask$1$1
0 %
0/3
N/A
1.2
 
 1  
 package org.jtheque.films.view.impl.actions.file;
 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.edt.SimpleTask;
 23  
 import org.jtheque.core.managers.view.impl.actions.JThequeAction;
 24  
 import org.jtheque.films.controllers.able.IExportController;
 25  
 import org.jtheque.films.view.able.IExportView;
 26  
 
 27  
 import java.awt.event.ActionEvent;
 28  
 
 29  
 /**
 30  
  * An action to validate the export view.
 31  
  *
 32  
  * @author Baptiste Wicht
 33  
  */
 34  
 public final class AcValidateExportView extends JThequeAction {
 35  
     /**
 36  
      * Construct a new AcValidateExportView.
 37  
      */
 38  
     public AcValidateExportView() {
 39  0
         super("generic.view.actions.validate");
 40  0
     }
 41  
 
 42  
     @Override
 43  
     public void actionPerformed(ActionEvent e) {
 44  0
         if (Managers.getManager(IBeansManager.class).<IExportView>getBean("exportView").validateContent()) {
 45  0
             Managers.getManager(IViewManager.class).execute(new ExportTask());
 46  
         }
 47  0
     }
 48  
 
 49  
     /**
 50  
      * A task to export the data.
 51  
      *
 52  
      * @author Baptiste Wicht
 53  
      */
 54  0
     private final class ExportTask extends SimpleTask {
 55  
         @Override
 56  
         public void run() {
 57  0
             final IExportController exportController = Managers.getManager(IBeansManager.class).getBean("exportController");
 58  
             
 59  0
             exportController.getView().startWait();
 60  
 
 61  0
             new Thread(new Runnable() {
 62  
                 @Override
 63  
                 public void run() {
 64  0
                     exportController.export(exportController.getView().getSearcher(), exportController.getView().getFilePath());
 65  
 
 66  0
                     Managers.getManager(IViewManager.class).execute(new SimpleTask() {
 67  
                         @Override
 68  
                         public void run() {
 69  0
                             exportController.getView().stopWait();
 70  0
                         }
 71  
                     });
 72  
 
 73  0
                     exportController.closeView();
 74  0
                 }
 75  
             }).start();
 76  0
         }
 77  
     }
 78  
 }