Revision 2e385b93
Added by Katja Luther over 5 years ago
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/checklist/e4/StatusDataCellEditor.java | ||
---|---|---|
8 | 8 |
*/ |
9 | 9 |
package eu.etaxonomy.taxeditor.editor.view.checklist.e4; |
10 | 10 |
|
11 |
import java.util.HashMap; |
|
11 | 12 |
import java.util.HashSet; |
12 | 13 |
import java.util.Iterator; |
14 |
import java.util.Map; |
|
13 | 15 |
import java.util.Set; |
14 | 16 |
|
15 | 17 |
import org.eclipse.nebula.widgets.nattable.edit.editor.ComboBoxCellEditor; |
... | ... | |
51 | 53 |
Object rowWrapper = editor.getBodyDataProvider().getRowObject(this.getRowIndex()); |
52 | 54 |
if(rowWrapper instanceof TaxonDistributionDTO){ |
53 | 55 |
NamedArea area = editor.getAreaToColumnIndexMap().get(getColumnIndex()); |
54 |
Set<DescriptionElementBase> elements = ((TaxonDistributionDTO) rowWrapper).getDistributionMap().get(area); |
|
56 |
Map<NamedArea, Set<DescriptionElementBase>> distributionMap = editor.taxonDistributionMap.get(((TaxonDistributionDTO) rowWrapper).getTaxonUuid()); |
|
57 |
if (distributionMap == null){ |
|
58 |
distributionMap = new HashMap(); |
|
59 |
editor.taxonDistributionMap.put(((TaxonDistributionDTO) rowWrapper).getTaxonUuid(),distributionMap); |
|
60 |
} |
|
61 |
Set<DescriptionElementBase> elements = distributionMap.get(area); |
|
55 | 62 |
if (elements == null){ |
56 | 63 |
|
57 | 64 |
}else if (elements.size() == 1){ |
... | ... | |
78 | 85 |
if (editor.getDefaultSource() != null){ |
79 | 86 |
newDistribution.addSource(DescriptionElementSource.NewPrimarySourceInstance(editor.getDefaultSource(), null)); |
80 | 87 |
} |
81 |
Set<DescriptionElementBase> elements = ((TaxonDistributionDTO) rowWrapper).getDistributionMap().get(area); |
|
88 |
Map<NamedArea, Set<DescriptionElementBase>> distributionMap = editor.taxonDistributionMap.get(((TaxonDistributionDTO) rowWrapper).getTaxonUuid()); |
|
89 |
if (distributionMap == null){ |
|
90 |
distributionMap = new HashMap(); |
|
91 |
editor.taxonDistributionMap.put(((TaxonDistributionDTO) rowWrapper).getTaxonUuid(),distributionMap); |
|
92 |
} |
|
93 |
Set<DescriptionElementBase> elements = distributionMap.get(area); |
|
82 | 94 |
if (elements == null){ |
83 | 95 |
elements = new HashSet<DescriptionElementBase>(); |
96 |
distributionMap.put(area, elements); |
|
84 | 97 |
} |
85 | 98 |
elements.add(newDistribution); |
86 |
((TaxonDistributionDTO) rowWrapper).getDistributionMap().put(area, elements); |
|
99 |
// ((TaxonDistributionDTO) rowWrapper).getDistributionMap().put(area, elements);
|
|
87 | 100 |
Set<TaxonDescription> descriptionSet = ((TaxonDistributionDTO) rowWrapper).getDescriptionsWrapper().getDescriptions(); |
88 | 101 |
Iterator<TaxonDescription> iterator = descriptionSet.iterator(); |
89 | 102 |
if (iterator.hasNext()){ |
90 | 103 |
iterator.next().addElement(newDistribution); |
91 | 104 |
}else{ |
92 |
Taxon taxon = ((TaxonDistributionDTO) rowWrapper).getDescriptionsWrapper().getTaxon();
|
|
105 |
Taxon taxon = ((TaxonDistributionDTO) rowWrapper).getTaxon(); |
|
93 | 106 |
TaxonDescription desc = TaxonDescription.NewInstance(taxon); |
94 | 107 |
desc.addElement(newDistribution); |
95 | 108 |
((TaxonDistributionDTO) rowWrapper).getDescriptionsWrapper().getDescriptions().add(desc); |
Also available in: Unified diff
ref #7854: session handling in distribution editor