Revision bd0b8f0e
Added by Patrick Plitzner over 5 years ago
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/descriptiveDataSet/matrix/categorical/CategoricalDataCellEditor.java | ||
---|---|---|
8 | 8 |
*/ |
9 | 9 |
package eu.etaxonomy.taxeditor.editor.descriptiveDataSet.matrix.categorical; |
10 | 10 |
|
11 |
import java.util.List; |
|
12 |
|
|
13 | 11 |
import org.eclipse.nebula.widgets.nattable.edit.editor.ComboBoxCellEditor; |
14 | 12 |
import org.eclipse.nebula.widgets.nattable.widget.NatCombo; |
15 | 13 |
import org.eclipse.swt.events.SelectionEvent; |
... | ... | |
19 | 17 |
|
20 | 18 |
import eu.etaxonomy.cdm.api.service.dto.RowWrapperDTO; |
21 | 19 |
import eu.etaxonomy.cdm.model.description.Feature; |
22 |
import eu.etaxonomy.cdm.model.description.State; |
|
23 | 20 |
import eu.etaxonomy.taxeditor.editor.descriptiveDataSet.matrix.CharacterMatrix; |
24 | 21 |
|
25 | 22 |
/** |
... | ... | |
31 | 28 |
public class CategoricalDataCellEditor extends ComboBoxCellEditor{ |
32 | 29 |
|
33 | 30 |
private CharacterMatrix matrix; |
34 |
private Feature feature; |
|
35 | 31 |
|
36 |
public CategoricalDataCellEditor(List<State> list, CharacterMatrix matrix, Feature feature) {
|
|
37 |
super(list, Math.max(3, Math.min(list.size()-1, 10)));
|
|
32 |
public CategoricalDataCellEditor(CharacterMatrix matrix, CategoricalComboBoxDataProvider categoricalComboBoxDataProvider) {
|
|
33 |
super(categoricalComboBoxDataProvider, categoricalComboBoxDataProvider.getMaxVisibleItems());
|
|
38 | 34 |
this.matrix = matrix; |
39 |
this.feature = feature; |
|
40 | 35 |
setUseCheckbox(true); |
41 | 36 |
setMultiselect(true); |
42 | 37 |
} |
... | ... | |
46 | 41 |
if(canonicalValue==null){ |
47 | 42 |
Object rowWrapper = matrix.getBodyDataProvider().getRowObject(this.getRowIndex()); |
48 | 43 |
if(rowWrapper instanceof RowWrapperDTO){ |
44 |
Feature feature = matrix.getIndexToFeatureMap().get(getColumnIndex()); |
|
49 | 45 |
((RowWrapperDTO) rowWrapper).addCategoricalData(feature); |
50 | 46 |
} |
51 | 47 |
} |
52 | 48 |
super.setCanonicalValue(canonicalValue); |
53 | 49 |
} |
54 | 50 |
|
55 |
/** |
|
56 |
* {@inheritDoc} |
|
57 |
*/ |
|
58 | 51 |
@Override |
59 | 52 |
protected Control activateCell(Composite parent, Object originalCanonicalValue) { |
60 | 53 |
if(matrix.getBodyDataProvider().getRowObject(this.getRowIndex()) instanceof RowWrapperDTO){ |
Also available in: Unified diff
Refactor categorical combo box creation