From ac05a823348b14e103b8e147a4c6ae28deef8a8a Mon Sep 17 00:00:00 2001 From: Katja Luther Date: Thu, 31 Jan 2019 15:11:05 +0100 Subject: [PATCH] ref #7854: fix problem of wrong setting of values in other cell --- .../checklist/e4/DistributionCellSelectionListener.java | 3 ++- .../view/checklist/e4/DistributionColumnAccessor.java | 5 ++++- .../editor/view/checklist/e4/DistributionEditorPart.java | 7 +++++-- .../editor/view/checklist/e4/StatusDataCellEditor.java | 3 ++- 4 files changed, 13 insertions(+), 5 deletions(-) diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/checklist/e4/DistributionCellSelectionListener.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/checklist/e4/DistributionCellSelectionListener.java index db8ff4b93..8681f7bd9 100755 --- a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/checklist/e4/DistributionCellSelectionListener.java +++ b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/checklist/e4/DistributionCellSelectionListener.java @@ -71,7 +71,8 @@ public class DistributionCellSelectionListener extends E4SelectionListener> distributionMap = editor.taxonDistributionMap.get(taxonWrapper.getTaxonUuid()); @@ -154,7 +155,9 @@ public class DistributionColumnAccessor implements IColumnPropertyAccessor coll = new HashSet(); editor.getDescriptionsToSave().forEach(dto->coll.add(dto)); + Set removeList = new HashSet(); for (TaxonDistributionDTO dto: coll){ Taxon taxon = null; for(TaxonDescription desc: dto.getDescriptionsWrapper().getDescriptions()){ @@ -241,11 +242,13 @@ ICdmEntitySessionEnabled, IPartContentHasSupplementalData, IPartContentHasDetail taxon.addDescription(desc); } if (taxon != null){ - CdmStore.getService(ITaxonService.class).merge(taxon, true); + MergeResult result = CdmStore.getService(ITaxonService.class).merge(taxon, true); + boolean removed = dto.getDescriptionsWrapper().getDescriptions().remove(desc); + System.err.println("removed:" + removed); } } } - + coll.removeAll(removeList); List> result = CdmStore.getService(IDescriptionService.class).mergeDescriptionElements(coll, true); for (MergeResult mergeRes: result ){ cdmEntitySession.load(mergeRes, true); diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/checklist/e4/StatusDataCellEditor.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/checklist/e4/StatusDataCellEditor.java index 26600f54d..c3aa058d4 100755 --- a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/checklist/e4/StatusDataCellEditor.java +++ b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/checklist/e4/StatusDataCellEditor.java @@ -49,6 +49,7 @@ public class StatusDataCellEditor extends ComboBoxCellEditor { Object rowWrapper = editor.getBodyDataProvider().getRowObject(this.getRowIndex()); if(rowWrapper instanceof TaxonDistributionDTO){ NamedArea area = editor.getAreaToColumnIndexMap().get(getColumnIndex()); + System.err.println("StatusDataCellEditor: " + ((TaxonDistributionDTO)rowWrapper).getNameCache()); Map> distributionMap = editor.taxonDistributionMap.get(((TaxonDistributionDTO) rowWrapper).getTaxonUuid()); if (distributionMap == null){ distributionMap = new HashMap(); @@ -60,7 +61,7 @@ public class StatusDataCellEditor extends ComboBoxCellEditor { }else if (elements.size() == 1){ DescriptionElementBase base = elements.iterator().next(); Distribution distr = (Distribution) base; - editor.descriptionsToSave.add( (TaxonDistributionDTO) rowWrapper); + //editor.descriptionsToSave.add( (TaxonDistributionDTO) rowWrapper); //TODO set value corresponding to preference if (distr.getStatus() != null){ if (distr.getStatus().getLabel() == ""){ -- 2.34.1