Coverage Report - org.jtheque.films.view.impl.actions.file.AcImport
 
Classes in this File Line Coverage Branch Coverage Complexity
AcImport
0 %
0/7
0 %
0/2
1.5
 
 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.resource.IResourceManager;
 21  
 import org.jtheque.core.managers.resource.ImageType;
 22  
 import org.jtheque.core.managers.view.impl.actions.JThequeAction;
 23  
 import org.jtheque.films.controllers.able.IImportController;
 24  
 import org.jtheque.films.utils.Constants;
 25  
 import org.jtheque.films.utils.Constants.Files.FileType;
 26  
 import org.jtheque.utils.StringUtils;
 27  
 
 28  
 import javax.annotation.Resource;
 29  
 import java.awt.event.ActionEvent;
 30  
 
 31  
 /**
 32  
  * Action to import something.
 33  
  *
 34  
  * @author Baptiste Wicht
 35  
  */
 36  
 public final class AcImport extends JThequeAction {
 37  
     private final FileType fileType;
 38  
 
 39  
     @Resource
 40  
     private IImportController importController;
 41  
 
 42  
     /**
 43  
      * Construct a new <code>AcImport</code> for a specific type of file.
 44  
      *
 45  
      * @param key      The internationalization key.
 46  
      * @param fileType The type of file.
 47  
      * @param icon     The icon of the action.
 48  
      */
 49  
     public AcImport(String key, String fileType, String icon) {
 50  0
         super(key);
 51  
 
 52  0
         this.fileType = FileType.fromString(fileType);
 53  
 
 54  0
         if (StringUtils.isNotEmpty(icon)) {
 55  0
             setIcon(Managers.getManager(IResourceManager.class).getIcon(Constants.IMAGE_BASE_NAME, icon, ImageType.PNG));
 56  
         }
 57  0
     }
 58  
 
 59  
     @Override
 60  
     public void actionPerformed(ActionEvent arg0) {
 61  0
         importController.openImportView(fileType);
 62  0
     }
 63  
 }