| 1 | |
package org.jtheque.films.view.impl.panels.search; |
| 2 | |
|
| 3 | |
|
| 4 | |
|
| 5 | |
|
| 6 | |
|
| 7 | |
|
| 8 | |
|
| 9 | |
|
| 10 | |
|
| 11 | |
|
| 12 | |
|
| 13 | |
|
| 14 | |
|
| 15 | |
|
| 16 | |
|
| 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 | |
|
| 38 | |
|
| 39 | |
|
| 40 | |
|
| 41 | 0 | public final class JPanelActorSearch extends JPanelSearch { |
| 42 | |
private static final long serialVersionUID = -3486881325683585131L; |
| 43 | |
|
| 44 | |
private JCheckBox boxNote; |
| 45 | |
private JCheckBox boxCountry; |
| 46 | |
|
| 47 | |
private DataContainerCachedComboBoxModel<Country> modelCountries; |
| 48 | |
private NotesComboBoxModel modelNotes; |
| 49 | |
|
| 50 | |
@Resource |
| 51 | |
private ICountriesService countriesService; |
| 52 | |
|
| 53 | |
|
| 54 | |
|
| 55 | |
|
| 56 | |
@PostConstruct |
| 57 | |
private void build() { |
| 58 | 0 | PanelBuilder builder = new PanelBuilder(this); |
| 59 | |
|
| 60 | 0 | boxNote = builder.add(new JCheckBox(), builder.gbcSet(0, 0)); |
| 61 | |
|
| 62 | 0 | builder.addI18nLabel(Person.NOTE, builder.gbcSet(1, 0)); |
| 63 | |
|
| 64 | 0 | modelNotes = new NotesComboBoxModel(); |
| 65 | |
|
| 66 | 0 | builder.addComboBox(modelNotes, builder.gbcSet(2, 0)); |
| 67 | |
|
| 68 | 0 | boxCountry = builder.add(new JCheckBox(), builder.gbcSet(0, 1)); |
| 69 | |
|
| 70 | 0 | builder.addI18nLabel(Person.COUNTRY, builder.gbcSet(1, 1)); |
| 71 | |
|
| 72 | 0 | modelCountries = new DataContainerCachedComboBoxModel<Country>(countriesService); |
| 73 | |
|
| 74 | 0 | builder.addComboBox(modelCountries, builder.gbcSet(2, 1)); |
| 75 | 0 | } |
| 76 | |
|
| 77 | |
@Override |
| 78 | |
public Searcher<org.jtheque.primary.od.able.Person> getSearcher() { |
| 79 | 0 | Searcher<org.jtheque.primary.od.able.Person> search = new DataSearcher<org.jtheque.primary.od.able.Person>(); |
| 80 | |
|
| 81 | 0 | if (boxCountry.isSelected()) { |
| 82 | 0 | search.addFilter(new CountryFilter<org.jtheque.primary.od.able.Person>(modelCountries.getSelectedData())); |
| 83 | |
} |
| 84 | |
|
| 85 | 0 | if (boxNote.isSelected()) { |
| 86 | 0 | search.addFilter(new NoteFilter<org.jtheque.primary.od.able.Person>(modelNotes.getSelectedNote())); |
| 87 | |
} |
| 88 | |
|
| 89 | 0 | return search; |
| 90 | |
} |
| 91 | |
|
| 92 | |
@Override |
| 93 | |
public String getTitle() { |
| 94 | 0 | return Managers.getManager(ILanguageManager.class).getMessage("search.actor.title"); |
| 95 | |
} |
| 96 | |
} |