Revision a55062d3
Added by Katja Luther over 2 years ago
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/descriptiveDataSet/matrix/quantitative/QuantitativeDataDialogComposite.java | ||
---|---|---|
11 | 11 |
|
12 | 12 |
import java.math.BigDecimal; |
13 | 13 |
import java.util.ArrayList; |
14 |
import java.util.Collections; |
|
15 |
import java.util.Comparator; |
|
14 | 16 |
import java.util.HashMap; |
15 | 17 |
import java.util.List; |
16 | 18 |
import java.util.Map; |
... | ... | |
30 | 32 |
import org.eclipse.swt.widgets.Text; |
31 | 33 |
|
32 | 34 |
import eu.etaxonomy.cdm.api.service.dto.QuantitativeDataDto; |
35 |
import eu.etaxonomy.cdm.api.service.dto.StatisticalMeasurementValueDto; |
|
33 | 36 |
import eu.etaxonomy.cdm.common.CdmUtils; |
34 | 37 |
import eu.etaxonomy.cdm.model.description.StatisticalMeasure; |
35 | 38 |
import eu.etaxonomy.cdm.persistence.dto.TermDto; |
... | ... | |
139 | 142 |
.filter(measure->measure.getType().getUuid().equals(StatisticalMeasure.EXACT_VALUE().getUuid())) |
140 | 143 |
.forEach(exact->addText(valuesComposite, exact.getType(), exact.getValue().toString())); |
141 | 144 |
|
145 |
// |
|
142 | 146 |
|
143 | 147 |
|
144 | 148 |
//add aggregation values |
145 |
if (editorValue.getFeatureDto().getRecommendedMeasurementUnits() != null){ |
|
146 |
editorValue.getFeatureDto().getRecommendedStatisticalMeasures() |
|
149 |
if (editorValue.getFeatureDto().getRecommendedStatisticalMeasures() != null){ |
|
150 |
List<TermDto> orderedStatisticalMeasures = new ArrayList<>(); |
|
151 |
orderedStatisticalMeasures.addAll(editorValue.getFeatureDto().getRecommendedStatisticalMeasures()); |
|
152 |
Collections.sort(orderedStatisticalMeasures, new Comparator<TermDto>() { |
|
153 |
@Override |
|
154 |
public int compare(TermDto o1, TermDto o2) { |
|
155 |
if (o1.getUuid().equals(o2.getUuid())){ |
|
156 |
return 0; |
|
157 |
} |
|
158 |
if (o1.getUuid().equals(StatisticalMeasure.MIN().getUuid())){ |
|
159 |
return -1; |
|
160 |
} |
|
161 |
if (o2.getUuid().equals(StatisticalMeasure.MIN().getUuid())){ |
|
162 |
return 1; |
|
163 |
} |
|
164 |
if (o1.getUuid().equals(StatisticalMeasure.MAX().getUuid())){ |
|
165 |
return 1; |
|
166 |
} |
|
167 |
if (o2.getUuid().equals(StatisticalMeasure.MAX().getUuid())){ |
|
168 |
return -1; |
|
169 |
} |
|
170 |
if (o1.getUuid().equals(StatisticalMeasure.TYPICAL_LOWER_BOUNDARY().getUuid()) && o2.getUuid().equals(StatisticalMeasure.TYPICAL_UPPER_BOUNDARY().getUuid())){ |
|
171 |
return -1; |
|
172 |
} |
|
173 |
if (o2.getUuid().equals(StatisticalMeasure.TYPICAL_LOWER_BOUNDARY().getUuid()) && o1.getUuid().equals(StatisticalMeasure.TYPICAL_UPPER_BOUNDARY().getUuid())){ |
|
174 |
return -1; |
|
175 |
} |
|
176 |
return o1.compareTo(o2); |
|
177 |
} |
|
178 |
}); |
|
179 |
|
|
180 |
orderedStatisticalMeasures |
|
147 | 181 |
.stream() |
148 | 182 |
.filter(sm->!sm.equals(exactValueDto)) |
149 | 183 |
.forEach(measure->{ |
Also available in: Unified diff
ref #9861: adapt editor to changes in termnodeDto-featurestateDto