Coverage Report - org.jtheque.films.view.impl.panels.search.JPanelRealizerSearch
 
Classes in this File Line Coverage Branch Coverage Complexity
JPanelRealizerSearch
0 %
0/18
0 %
0/4
1.667
 
 1  
 package org.jtheque.films.view.impl.panels.search;
 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.language.ILanguageManager;
 21  
 import org.jtheque.core.utils.ui.PanelBuilder;
 22  
 import org.jtheque.films.services.impl.utils.search.DataSearcher;
 23  
 import org.jtheque.films.services.impl.utils.search.Searcher;
 24  
 import org.jtheque.films.services.impl.utils.search.filters.CountryFilter;
 25  
 import org.jtheque.films.services.impl.utils.search.filters.NoteFilter;
 26  
 import org.jtheque.films.utils.Constants.Properties.Person;
 27  
 import org.jtheque.primary.od.able.Country;
 28  
 import org.jtheque.primary.services.able.ICountriesService;
 29  
 import org.jtheque.primary.view.impl.models.DataContainerCachedComboBoxModel;
 30  
 import org.jtheque.primary.view.impl.models.NotesComboBoxModel;
 31  
 
 32  
 import javax.annotation.PostConstruct;
 33  
 import javax.annotation.Resource;
 34  
 import javax.swing.JCheckBox;
 35  
 
 36  
 /**
 37  
  * A search panel for realizers.
 38  
  *
 39  
  * @author Baptiste Wicht
 40  
  */
 41  0
 public final class JPanelRealizerSearch extends JPanelSearch {
 42  
     private static final long serialVersionUID = -3486881325683585131L;
 43  
 
 44  
     /* Graphics components */
 45  
     private JCheckBox boxNote;
 46  
     private JCheckBox boxCountry;
 47  
 
 48  
     private NotesComboBoxModel modelNotes;
 49  
     private DataContainerCachedComboBoxModel<Country> modelCountries;
 50  
 
 51  
     @Resource
 52  
     private ICountriesService countriesService;
 53  
 
 54  
     /**
 55  
      * Build the panel.
 56  
      */
 57  
     @PostConstruct
 58  
     private void build() {
 59  0
         PanelBuilder builder = new PanelBuilder(this);
 60  
 
 61  0
         boxNote = builder.add(new JCheckBox(), builder.gbcSet(0, 0));
 62  
 
 63  0
         builder.addI18nLabel(Person.NOTE, builder.gbcSet(1, 0));
 64  
 
 65  0
         modelNotes = new NotesComboBoxModel();
 66  
 
 67  0
         builder.addComboBox(modelNotes, builder.gbcSet(2, 0));
 68  
 
 69  0
         boxCountry = builder.add(new JCheckBox(), builder.gbcSet(0, 1));
 70  
 
 71  0
         builder.addI18nLabel(Person.COUNTRY, builder.gbcSet(1, 1));
 72  
 
 73  0
         modelCountries = new DataContainerCachedComboBoxModel<Country>(countriesService);
 74  
 
 75  0
         builder.addComboBox(modelCountries, builder.gbcSet(2, 1));
 76  0
     }
 77  
 
 78  
     @Override
 79  
     public Searcher<org.jtheque.primary.od.able.Person> getSearcher() {
 80  0
         Searcher<org.jtheque.primary.od.able.Person> search = new DataSearcher<org.jtheque.primary.od.able.Person>();
 81  
 
 82  0
         if (boxCountry.isSelected()) {
 83  0
             search.addFilter(new CountryFilter<org.jtheque.primary.od.able.Person>(modelCountries.getSelectedData()));
 84  
         }
 85  
 
 86  0
         if (boxNote.isSelected()) {
 87  0
             search.addFilter(new NoteFilter<org.jtheque.primary.od.able.Person>(modelNotes.getSelectedNote()));
 88  
         }
 89  
 
 90  0
         return search;
 91  
     }
 92  
 
 93  
     @Override
 94  
     public String getTitle() {
 95  0
         return Managers.getManager(ILanguageManager.class).getMessage("search.realizer.title");
 96  
     }
 97  
 }