Coverage Report - org.jtheque.films.view.impl.panels.JPanelInfosOthers
 
Classes in this File Line Coverage Branch Coverage Complexity
JPanelInfosOthers
0 %
0/17
N/A
1
 
 1  
 package org.jtheque.films.view.impl.panels;
 2  
 
 3  
 import org.jtheque.core.managers.error.JThequeError;
 4  
 import org.jtheque.core.managers.view.impl.components.panel.FileChooserPanel;
 5  
 import org.jtheque.core.utils.ui.PanelBuilder;
 6  
 import org.jtheque.core.utils.ui.constraints.ConstraintManager;
 7  
 import org.jtheque.films.persistence.od.able.Film;
 8  
 import org.jtheque.films.utils.Constants.Properties;
 9  
 import org.jtheque.films.view.able.IInfosOthersView;
 10  
 import org.jtheque.films.view.impl.fb.IFilmFormBean;
 11  
 import org.jtheque.primary.view.impl.listeners.ObjectChangedEvent;
 12  
 import org.jtheque.utils.ui.GridBagUtils;
 13  
 
 14  
 import javax.annotation.PostConstruct;
 15  
 import javax.swing.JComponent;
 16  
 import javax.swing.JPanel;
 17  
 import java.util.Collection;
 18  
 
 19  
 /*
 20  
  * This file is part of JTheque.
 21  
  *
 22  
  * JTheque is free software: you can redistribute it and/or modify
 23  
  * it under the terms of the GNU General Public License as published by
 24  
  * the Free Software Foundation, either version 3 of the License.
 25  
  *
 26  
  * JTheque is distributed in the hope that it will be useful,
 27  
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
 28  
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 29  
  * GNU General Public License for more details.
 30  
  *
 31  
  * You should have received a copy of the GNU General Public License
 32  
  * along with JTheque.  If not, see <http://www.gnu.org/licenses/>.
 33  
  */
 34  
 
 35  
 /**
 36  
  * Panel for the others informations about film.
 37  
  *
 38  
  * @author Baptiste Wicht
 39  
  */
 40  0
 public final class JPanelInfosOthers extends JPanel implements IInfosOthersView {
 41  
     private FileChooserPanel fieldFile;
 42  
 
 43  
     /**
 44  
      * Build the view.
 45  
      */
 46  
     @PostConstruct
 47  
     private void build() {
 48  0
         PanelBuilder builder = new PanelBuilder(this);
 49  
 
 50  0
         fieldFile = new FileChooserPanel();
 51  0
         fieldFile.setTextKey(Properties.Film.FILE_PATH);
 52  
 
 53  0
         builder.add(fieldFile, builder.gbcSet(0, 0, GridBagUtils.BOTH, GridBagUtils.ABOVE_BASELINE_LEADING, 0, 0, 1.0, 1.0));
 54  0
     }
 55  
 
 56  
     @Override
 57  
     public void objectChanged(ObjectChangedEvent event) {
 58  0
         Film film = (Film) event.getObject();
 59  
 
 60  0
         fieldFile.setFilePath(film.getFilePath());
 61  0
     }
 62  
 
 63  
     /**
 64  
      * Fill the form bean.
 65  
      *
 66  
      * @param fb The form bean to fill.
 67  
      */
 68  
     @Override
 69  
     public void fillFilm(IFilmFormBean fb) {
 70  0
         fb.setFilePath(fieldFile.getFilePath());
 71  0
     }
 72  
 
 73  
     @Override
 74  
     public void setEnabled(boolean enabled) {
 75  0
         fieldFile.setEnabled(enabled);
 76  
 
 77  0
         super.setEnabled(enabled);
 78  0
     }
 79  
 
 80  
     /**
 81  
      * Validate the view.
 82  
      *
 83  
      * @param errors The errors list to fill.
 84  
      */
 85  
     @Override
 86  
     public void validate(Collection<JThequeError> errors) {
 87  0
         ConstraintManager.validate(Properties.Film.FILE_PATH, fieldFile.getFilePath(), errors);
 88  0
     }
 89  
 
 90  
     @Override
 91  
     public JComponent getImpl() {
 92  0
         return this;
 93  
     }
 94  
 }