import java.io.File;
import java.util.ArrayList;
import java.util.Collection;
+import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
if(character.isSupportsCategoricalData()){
List<State> supportedStates = new ArrayList<>();
character.getSupportedCategoricalEnumerations().forEach(voc->supportedStates.addAll(voc.getTerms()));
+ Collections.sort(supportedStates, (state1, state2)->state1.getLabel().compareTo(state2.getLabel()));
categoricalFeatureToStateMap.put(character, supportedStates);
}
});
public class CategoricalComboBoxDataProvider implements IComboBoxDataProvider {
private CharacterMatrix matrix;
- private int maxVisibleItems;
public CategoricalComboBoxDataProvider(CharacterMatrix matrix) {
super();
public List<?> getValues(int columnIndex, int rowIndex) {
Feature feature = matrix.getIndexToCharacterMap().get(columnIndex);
List<State> supportedStatesForCategoricalFeature = matrix.getSupportedStatesForCategoricalFeature(feature);
- maxVisibleItems = Math.max(3, Math.min(supportedStatesForCategoricalFeature.size()-1, 10));
return supportedStatesForCategoricalFeature;
}
- int getMaxVisibleItems(){
- return maxVisibleItems;
- }
}
private CharacterMatrix matrix;
public CategoricalDataCellEditor(CharacterMatrix matrix, CategoricalComboBoxDataProvider categoricalComboBoxDataProvider) {
- super(categoricalComboBoxDataProvider, categoricalComboBoxDataProvider.getMaxVisibleItems());
+ super(categoricalComboBoxDataProvider, 10);
this.matrix = matrix;
setUseCheckbox(true);
setMultiselect(true);