Project

General

Profile

Revision 7a105035

ID7a1050358100c7de9e619f7da9812261fac18e83
Parent c9018a76
Child 6f3152d1

Added by Katja Luther almost 4 years ago

fix #7237: add empty entry in combobox and delete distribution if selected in distribution editor

View differences:

eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/checklist/e4/DistributionEditingSupportE4.java
1 1
package eu.etaxonomy.taxeditor.editor.view.checklist.e4;
2 2

  
3
import java.util.ArrayList;
3 4
import java.util.Arrays;
4 5
import java.util.List;
5 6
import java.util.Set;
......
74 75
        });
75 76
//        selectionChangedListener = (event -> selService.setSelection(event));
76 77
//        cellEditor.addListener(selectionChangedListener);
78

  
77 79
        cellEditor.setContentProvider(new ArrayContentProvider());
80

  
78 81
        // TODO set input
79 82
//        List<PresenceAbsenceTermBase> input = CdmStore.getTermManager()
80 83
//                .getPreferredTerms(PresenceAbsenceTermBase.class);
81 84
//        selectionChangedListener = (event -> selService.setSelection(event));
82 85
//        viewer.addSelectionChangedListener(selectionChangedListener);
86
        List<DefinedTermBase<?>> inputAll = new ArrayList<>();
87
        PresenceAbsenceTerm noneTerm = PresenceAbsenceTerm.NewInstance();
88
        noneTerm.setTitleCache(" ", true);
89
        inputAll.add(noneTerm);
83 90
        List<DefinedTermBase<?>> input = CdmStore.getTermManager().getPreferredTerms(TermType.PresenceAbsenceTerm);
84
        cellEditor.setInput(input);
91
        inputAll.addAll(1, input);
92
        cellEditor.setInput(inputAll);
93

  
85 94
    }
86 95

  
87 96
    @Override
......
136 145
            Taxon taxon = (Taxon) element;
137 146
            PresenceAbsenceTerm occurenceStatus = (PresenceAbsenceTerm) value;
138 147
            Distribution distribution = getDistributionForColumn(taxon);
148

  
139 149
            if (distribution != null) {
140 150
                // change status for already exsiting distribution
141
                distribution.setStatus(occurenceStatus);
151
                if (occurenceStatus.getTitleCache().equals(" ")){
152
                    TaxonDescription descr = (TaxonDescription)distribution.getInDescription();
153
                    descr.removeElement(distribution);
154
                }else{
155
                    distribution.setStatus(occurenceStatus);
156
                }
142 157
            } else {
143 158
                createDistributionForColumn(taxon, occurenceStatus);
144 159
            }

Also available in: Unified diff

Add picture from clipboard (Maximum size: 40 MB)