Project

General

Profile

Revision ac05a823

IDac05a823348b14e103b8e147a4c6ae28deef8a8a
Parent 38b475da
Child 6f7fec64

Added by Katja Luther over 1 year ago

ref #7854: fix problem of wrong setting of values in other cell

View differences:

eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/checklist/e4/DistributionCellSelectionListener.java
71 71
                    return;
72 72
                }
73 73
            }
74
        }else if (event instanceof CellVisualChangeEvent){
74
        }
75
        else if (event instanceof CellVisualChangeEvent){
75 76
            CellVisualChangeEvent cellSelectionEvent = (CellVisualChangeEvent)event;
76 77
            int columnPosition = cellSelectionEvent.getColumnPosition();
77 78
            int rowPosition = cellSelectionEvent.getRowPosition();
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/checklist/e4/DistributionColumnAccessor.java
117 117
     */
118 118
    @Override
119 119
    public void setDataValue(TaxonDistributionDTO taxonWrapper, int columnIndex, Object newValue) {
120
        System.err.println("DistributionColumnAccessor: " + taxonWrapper.getNameCache());
120 121
           if (newValue instanceof PresenceAbsenceTerm){
121 122
                NamedArea area =editor.getAreaToColumnIndexMap().get(columnIndex);
122 123
                Map<NamedArea, Set<DescriptionElementBase>> distributionMap = editor.taxonDistributionMap.get(taxonWrapper.getTaxonUuid());
......
154 155
                      dist.addSource(DescriptionElementSource.NewPrimarySourceInstance(editor.getDefaultSource(), null));
155 156
                    }
156 157
                    desc.addElement(dist);
157
                    editor.part.getCdmEntitySession().load(desc, true);
158
                    if(desc.isPersited()){
159
                        editor.part.getCdmEntitySession().load(desc, true);
160
                    }
158 161
                    distributions.add(dist);
159 162

  
160 163

  
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/checklist/e4/DistributionEditorPart.java
231 231
    protected void saveDistributions() {
232 232
        Set<TaxonDistributionDTO> coll = new HashSet();
233 233
        editor.getDescriptionsToSave().forEach(dto->coll.add(dto));
234
        Set<TaxonDistributionDTO> removeList = new HashSet();
234 235
        for (TaxonDistributionDTO dto: coll){
235 236
            Taxon taxon = null;
236 237
            for(TaxonDescription desc: dto.getDescriptionsWrapper().getDescriptions()){
......
241 242
                    taxon.addDescription(desc);
242 243
                }
243 244
                if (taxon != null){
244
                    CdmStore.getService(ITaxonService.class).merge(taxon, true);
245
                    MergeResult result = CdmStore.getService(ITaxonService.class).merge(taxon, true);
246
                    boolean removed = dto.getDescriptionsWrapper().getDescriptions().remove(desc);
247
                    System.err.println("removed:"  + removed);
245 248
                }
246 249
            }
247 250
        }
248

  
251
        coll.removeAll(removeList);
249 252
        List<MergeResult<DescriptionBase>> result = CdmStore.getService(IDescriptionService.class).mergeDescriptionElements(coll, true);
250 253
        for (MergeResult<DescriptionBase> mergeRes: result ){
251 254
            cdmEntitySession.load(mergeRes, true);
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/checklist/e4/StatusDataCellEditor.java
49 49
            Object rowWrapper = editor.getBodyDataProvider().getRowObject(this.getRowIndex());
50 50
            if(rowWrapper instanceof TaxonDistributionDTO){
51 51
                NamedArea area = editor.getAreaToColumnIndexMap().get(getColumnIndex());
52
                System.err.println("StatusDataCellEditor: " + ((TaxonDistributionDTO)rowWrapper).getNameCache());
52 53
                Map<NamedArea, Set<DescriptionElementBase>> distributionMap = editor.taxonDistributionMap.get(((TaxonDistributionDTO) rowWrapper).getTaxonUuid());
53 54
                if (distributionMap == null){
54 55
                    distributionMap = new HashMap();
......
60 61
                }else if (elements.size() == 1){
61 62
                    DescriptionElementBase base = elements.iterator().next();
62 63
                    Distribution distr = (Distribution) base;
63
                    editor.descriptionsToSave.add( (TaxonDistributionDTO) rowWrapper);
64
                    //editor.descriptionsToSave.add( (TaxonDistributionDTO) rowWrapper);
64 65
                    //TODO set value corresponding to preference
65 66
                    if (distr.getStatus() != null){
66 67
                        if (distr.getStatus().getLabel() == ""){

Also available in: Unified diff

Add picture from clipboard (Maximum size: 40 MB)