1 package fr.ifremer.tutti.ui.swing.content.operation.catches.species.split;
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 fr.ifremer.tutti.persistence.entities.data.SampleCategory;
26 import fr.ifremer.tutti.persistence.entities.data.SampleCategoryModelEntry;
27 import fr.ifremer.tutti.persistence.entities.referential.CaracteristicQualitativeValue;
28 import fr.ifremer.tutti.ui.swing.util.AbstractTuttiBeanUIModel;
29
30 import java.io.Serializable;
31
32
33
34
35
36
37
38 public class SplitSpeciesBatchRowModel
39 extends AbstractTuttiBeanUIModel<SplitSpeciesBatchRowModel, SplitSpeciesBatchRowModel> {
40
41 private static final long serialVersionUID = 1L;
42
43 public static final String PROPERTY_CATEGORY_VALUE = "categoryValue";
44
45 public static final String PROPERTY_WEIGHT = "weight";
46
47 public static final String PROPERTY_SELECTED = "selected";
48
49 public static final String PROPERTY_EDITABLE = "editable";
50
51
52
53
54
55
56 protected final SampleCategory<Serializable> category = SampleCategory.newSample(null);
57
58
59
60
61
62
63 protected boolean selected;
64
65
66
67
68
69
70 protected boolean editable;
71
72 public SplitSpeciesBatchRowModel() {
73 super(null, null);
74 }
75
76
77
78
79
80 public void setCategoryType(SampleCategoryModelEntry categoryType) {
81 category.setCategoryDef(categoryType);
82 }
83
84 public Serializable getCategoryValue() {
85 return category.getCategoryValue();
86 }
87
88 public void setCategoryValue(Serializable categoryValue) {
89 Object oldValue = getCategoryValue();
90 category.setCategoryValue(categoryValue);
91 firePropertyChange(PROPERTY_CATEGORY_VALUE, oldValue, categoryValue);
92 }
93
94 public void setCategoryValue(CaracteristicQualitativeValue categoryValue) {
95 Object oldValue = getCategoryValue();
96 category.setCategoryValue(categoryValue);
97 firePropertyChange(PROPERTY_CATEGORY_VALUE, oldValue, categoryValue);
98 }
99
100 public void setCategoryValue(Float categoryValue) {
101 Object oldValue = getCategoryValue();
102 category.setCategoryValue(categoryValue);
103 firePropertyChange(PROPERTY_CATEGORY_VALUE, oldValue, categoryValue);
104 }
105
106 public Float getWeight() {
107 return category.getCategoryWeight();
108 }
109
110 public void setWeight(Float weight) {
111 Object oldValue = getWeight();
112 category.setCategoryWeight(weight);
113 firePropertyChange(PROPERTY_WEIGHT, oldValue, weight);
114 }
115
116 public boolean isSelected() {
117 return selected;
118 }
119
120 public void setSelected(boolean selected) {
121 Object oldValue = isSelected();
122 this.selected = selected;
123 firePropertyChange(PROPERTY_SELECTED, oldValue, selected);
124 }
125
126 public boolean isEditable() {
127 return editable;
128 }
129
130 public void setEditable(boolean editable) {
131 Object oldValue = isEditable();
132 this.editable = editable;
133 firePropertyChange(PROPERTY_EDITABLE, oldValue, editable);
134 }
135
136 @Override
137 protected SplitSpeciesBatchRowModel newEntity() {
138 return new SplitSpeciesBatchRowModel();
139 }
140 }