Revision f8da7861
Added by Patrick Plitzner about 6 years ago
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/workingSet/matrix/categorical/CategoricalDataCellEditor.java | ||
---|---|---|
19 | 19 |
import org.eclipse.swt.widgets.Control; |
20 | 20 |
|
21 | 21 |
import eu.etaxonomy.cdm.model.description.CategoricalData; |
22 |
import eu.etaxonomy.cdm.model.description.Feature; |
|
22 | 23 |
import eu.etaxonomy.cdm.model.description.State; |
23 | 24 |
import eu.etaxonomy.taxeditor.editor.workingSet.matrix.CharacterMatrix; |
25 |
import eu.etaxonomy.taxeditor.editor.workingSet.matrix.RowWrapper; |
|
24 | 26 |
|
25 | 27 |
/** |
26 | 28 |
* @author pplitzner |
... | ... | |
30 | 32 |
public class CategoricalDataCellEditor extends FilterRowComboBoxCellEditor{ |
31 | 33 |
|
32 | 34 |
private CharacterMatrix matrix; |
35 |
private Feature feature; |
|
33 | 36 |
|
34 |
public CategoricalDataCellEditor(IComboBoxDataProvider dataProvider, int maxVisibleItems, CharacterMatrix matrix) { |
|
37 |
public CategoricalDataCellEditor(IComboBoxDataProvider dataProvider, int maxVisibleItems, CharacterMatrix matrix, Feature feature) {
|
|
35 | 38 |
super(dataProvider, maxVisibleItems); |
36 | 39 |
this.matrix = matrix; |
40 |
this.feature = feature; |
|
37 | 41 |
} |
38 | 42 |
|
39 | 43 |
@Override |
40 | 44 |
public void setCanonicalValue(Object canonicalValue) { |
45 |
if(canonicalValue==null){ |
|
46 |
CategoricalData data = CategoricalData.NewInstance(feature); |
|
47 |
RowWrapper rowWrapper = matrix.getBodyDataProvider().getRowObject(this.getRowIndex()); |
|
48 |
rowWrapper.getSpecimenDescription().addElement(data); |
|
49 |
canonicalValue = data; |
|
50 |
} |
|
41 | 51 |
if (canonicalValue instanceof CategoricalData) { |
42 | 52 |
CategoricalData data = (CategoricalData)canonicalValue; |
43 | 53 |
List<State> states = data.getStatesOnly(); |
Also available in: Unified diff
ref #7095 Init description elements when activating cell editor