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 JPanelRealizerSearch extends JPanelSearch { |
42 | |
private static final long serialVersionUID = -3486881325683585131L; |
43 | |
|
44 | |
|
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 | |
|
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 | |
} |