Coverage Report - org.jtheque.films.view.impl.frames.ImportView
 
Classes in this File Line Coverage Branch Coverage Complexity
ImportView
0 %
0/19
0 %
0/2
1.2
 
 1  
 package org.jtheque.films.view.impl.frames;
 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.error.JThequeError;
 20  
 import org.jtheque.core.managers.view.impl.components.panel.FileChooserPanel;
 21  
 import org.jtheque.core.managers.view.impl.frame.abstraction.SwingDialogView;
 22  
 import org.jtheque.core.utils.ui.PanelBuilder;
 23  
 import org.jtheque.films.view.able.IImportView;
 24  
 import org.jtheque.films.view.impl.actions.CloseViewAction;
 25  
 import org.jtheque.films.view.impl.actions.file.AcValidateImportView;
 26  
 import org.jtheque.utils.io.SimpleFilter;
 27  
 
 28  
 import java.awt.Color;
 29  
 import java.awt.Container;
 30  
 import java.awt.Frame;
 31  
 import java.util.Collection;
 32  
 
 33  
 /**
 34  
  * An import view.
 35  
  *
 36  
  * @author Baptiste Wicht
 37  
  */
 38  
 public final class ImportView extends SwingDialogView implements IImportView {
 39  
     private static final long serialVersionUID = 4572891526592518739L;
 40  
 
 41  
     private FileChooserPanel chooser;
 42  
 
 43  
     /**
 44  
      * Construct a new <code>JFrameImport</code>.
 45  
      *
 46  
      * @param parent         The parent frame.
 47  
      */
 48  
     public ImportView(Frame parent) {
 49  0
         super(parent);
 50  
         
 51  0
         setResizable(false);
 52  0
         setTitleKey("import.view.title");
 53  0
         setContentPane(buildContentPane());
 54  
 
 55  0
         pack();
 56  0
         setLocationRelativeTo(getOwner());
 57  0
     }
 58  
 
 59  
     /**
 60  
      * Return the content pane initialized.
 61  
      *
 62  
      * @return The content pane.
 63  
      */
 64  
     private Container buildContentPane() {
 65  0
         PanelBuilder builder = new PanelBuilder();
 66  
 
 67  0
         chooser = new FileChooserPanel();
 68  0
         chooser.setTextKey("import.view.filePath");
 69  0
         chooser.setBackground(Color.white);
 70  0
         builder.add(chooser, builder.gbcSet(0, 0));
 71  
 
 72  0
         builder.addButtonBar(builder.gbcSet(0, 1), new AcValidateImportView(), new CloseViewAction("generic.view.actions.cancel", this));
 73  
 
 74  0
         return builder.getPanel();
 75  
     }
 76  
 
 77  
     @Override
 78  
     public String getFilePath() {
 79  0
         return chooser.getFilePath();
 80  
     }
 81  
 
 82  
     @Override
 83  
     public void sendMessage(String message, Object value) {
 84  0
         if ("filter".equals(message)) {
 85  0
             chooser.setFileFilter((SimpleFilter) value);
 86  
         }
 87  0
     }
 88  
 
 89  
     @Override
 90  
     protected void validate(Collection<JThequeError> errors) {
 91  0
     }
 92  
 }