3 * Copyright (C) 2018 EDIT
4 * European Distributed Institute of Taxonomy
5 * http://www.e-taxonomy.eu
7 * The contents of this file are subject to the Mozilla Public License Version 1.1
8 * See LICENSE.TXT at the top of this package for the full license terms.
10 package eu
.etaxonomy
.taxeditor
.editor
.descriptiveDataSet
.matrix
.categorical
;
12 import java
.util
.List
;
14 import org
.eclipse
.nebula
.widgets
.nattable
.edit
.editor
.IComboBoxDataProvider
;
16 import eu
.etaxonomy
.cdm
.model
.description
.Feature
;
17 import eu
.etaxonomy
.cdm
.model
.description
.State
;
18 import eu
.etaxonomy
.taxeditor
.editor
.descriptiveDataSet
.matrix
.CharacterMatrix
;
25 public class CategoricalComboBoxDataProvider
implements IComboBoxDataProvider
{
27 private CharacterMatrix matrix
;
28 private int maxVisibleItems
;
30 public CategoricalComboBoxDataProvider(CharacterMatrix matrix
) {
36 public List
<?
> getValues(int columnIndex
, int rowIndex
) {
37 Feature feature
= matrix
.getIndexToCharacterMap().get(columnIndex
);
38 List
<State
> supportedStatesForCategoricalFeature
= matrix
.getSupportedStatesForCategoricalFeature(feature
);
39 maxVisibleItems
= Math
.max(3, Math
.min(supportedStatesForCategoricalFeature
.size()-1, 10));
40 return supportedStatesForCategoricalFeature
;
43 int getMaxVisibleItems(){
44 return maxVisibleItems
;