Project

General

Profile

Revision 5decc8b9

ID5decc8b93dc4e0e99c1acba852b7dee27cd5330c
Parent d741ab8f
Child baf7d6f0

Added by Patrick Plitzner over 1 year ago

ref #8242 Set max items for dropdown to 10 + sort items

View differences:

eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/descriptiveDataSet/matrix/CharacterMatrix.java
11 11
import java.io.File;
12 12
import java.util.ArrayList;
13 13
import java.util.Collection;
14
import java.util.Collections;
14 15
import java.util.HashMap;
15 16
import java.util.List;
16 17
import java.util.Map;
......
291 292
            if(character.isSupportsCategoricalData()){
292 293
                List<State> supportedStates = new ArrayList<>();
293 294
                character.getSupportedCategoricalEnumerations().forEach(voc->supportedStates.addAll(voc.getTerms()));
295
                Collections.sort(supportedStates, (state1, state2)->state1.getLabel().compareTo(state2.getLabel()));
294 296
                categoricalFeatureToStateMap.put(character, supportedStates);
295 297
            }
296 298
        });
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/descriptiveDataSet/matrix/categorical/CategoricalComboBoxDataProvider.java
25 25
public class CategoricalComboBoxDataProvider implements IComboBoxDataProvider {
26 26

  
27 27
    private CharacterMatrix matrix;
28
    private int maxVisibleItems;
29 28

  
30 29
    public CategoricalComboBoxDataProvider(CharacterMatrix matrix) {
31 30
        super();
......
36 35
    public List<?> getValues(int columnIndex, int rowIndex) {
37 36
        Feature feature = matrix.getIndexToCharacterMap().get(columnIndex);
38 37
        List<State> supportedStatesForCategoricalFeature = matrix.getSupportedStatesForCategoricalFeature(feature);
39
        maxVisibleItems = Math.max(3, Math.min(supportedStatesForCategoricalFeature.size()-1, 10));
40 38
        return supportedStatesForCategoricalFeature;
41 39
    }
42 40

  
43
    int getMaxVisibleItems(){
44
        return maxVisibleItems;
45
    }
46 41
}
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/descriptiveDataSet/matrix/categorical/CategoricalDataCellEditor.java
30 30
    private CharacterMatrix matrix;
31 31

  
32 32
    public CategoricalDataCellEditor(CharacterMatrix matrix, CategoricalComboBoxDataProvider categoricalComboBoxDataProvider) {
33
        super(categoricalComboBoxDataProvider, categoricalComboBoxDataProvider.getMaxVisibleItems());
33
        super(categoricalComboBoxDataProvider, 10);
34 34
        this.matrix = matrix;
35 35
        setUseCheckbox(true);
36 36
        setMultiselect(true);

Also available in: Unified diff

Add picture from clipboard (Maximum size: 40 MB)