1 package fr.ifremer.tutti.ui.swing.util.species;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25 import com.google.common.collect.Lists;
26 import fr.ifremer.tutti.persistence.entities.referential.Species;
27 import fr.ifremer.tutti.ui.swing.util.AbstractTuttiBeanUIModel;
28
29 import java.util.List;
30
31
32
33
34
35 public class SelectSpeciesUIModel extends AbstractTuttiBeanUIModel<SelectSpeciesUIModel, SelectSpeciesUIModel> {
36
37 public static final String PROPERTY_SPECIES = "species";
38
39 public static final String PROPERTY_FILTERED_SPECIES = "filteredSpecies";
40
41 public static final String PROPERTY_SELECTED_SPECIES = "selectedSpecies";
42
43 public static final String PROPERTY_SHOW_ALL_SPECIES = "showAllSpecies";
44
45 protected List<Species> species = Lists.newArrayList();
46
47 protected List<Species> filteredSpecies = null;
48
49 protected Species selectedSpecies;
50
51 protected boolean showAllSpecies;
52
53 public SelectSpeciesUIModel() {
54 super(null, null);
55 }
56
57 public List<Species> getSpecies() {
58 return species;
59 }
60
61 public void setSpecies(List<Species> species) {
62 Object oldValue = getSpecies();
63 this.species = Lists.newArrayList(species);
64 firePropertyChange(PROPERTY_SPECIES, oldValue, this.species);
65 }
66
67 public Species getSelectedSpecies() {
68 return selectedSpecies;
69 }
70
71 public void setSelectedSpecies(Species selectedSpecies) {
72 Object oldValue = getSelectedSpecies();
73 this.selectedSpecies = selectedSpecies;
74 firePropertyChange(PROPERTY_SELECTED_SPECIES, oldValue, selectedSpecies);
75 }
76
77 public boolean isShowAllSpecies() {
78 return showAllSpecies;
79 }
80
81 public void setShowAllSpecies(boolean showAllSpecies) {
82 Object oldValue = isShowAllSpecies();
83 this.showAllSpecies = showAllSpecies;
84 firePropertyChange(PROPERTY_SHOW_ALL_SPECIES, oldValue, showAllSpecies);
85 }
86
87 public List<Species> getFilteredSpecies() {
88 return filteredSpecies;
89 }
90
91 public void setFilteredSpecies(List<Species> filteredSpecies) {
92 Object oldValue = getFilteredSpecies();
93 this.filteredSpecies = filteredSpecies;
94 firePropertyChange(PROPERTY_FILTERED_SPECIES, oldValue, filteredSpecies);
95 }
96
97 @Override
98 protected SelectSpeciesUIModel newEntity() {
99 return new SelectSpeciesUIModel();
100 }
101 }