Revision bd5a558a
Added by Patrick Plitzner almost 6 years ago
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/descriptiveDataSet/matrix/CharacterMatrixBottomToolbar.java | ||
---|---|---|
130 | 130 |
Button btnAggregate = new Button(this, SWT.PUSH); |
131 | 131 |
btnAggregate.setText("Aggregate"); |
132 | 132 |
btnAggregate.addSelectionListener(new SelectionAdapter() { |
133 |
@SuppressWarnings("unchecked") |
|
134 | 133 |
@Override |
135 | 134 |
public void widgetSelected(SelectionEvent e) { |
136 | 135 |
Set<TaxonNode> taxonSubtreeFilter = matrix.getDescriptiveDataSet().getTaxonSubtreeFilter(); |
... | ... | |
161 | 160 |
//aggregate histogram for categorical tooltip |
162 | 161 |
Map<Feature, CategoricalDataHistogram> featureToHistogramMap = matrix.getFeatureToHistogramMap(); |
163 | 162 |
featureToHistogramMap.clear(); |
164 |
// matrix.getFeatures().forEach(feature->{ |
|
165 |
matrix.getDescriptions() |
|
166 |
.forEach(o -> ((RowWrapperDTO) o).getSpecimenDescription().getElements().stream() |
|
167 |
.filter(descriptionElement -> descriptionElement instanceof CategoricalData) |
|
168 |
.forEach(categoricalData -> { |
|
169 |
Feature feature = ((CategoricalData) categoricalData).getFeature(); |
|
170 |
CategoricalDataHistogram dataHistogram = featureToHistogramMap.get(feature); |
|
171 |
if(dataHistogram==null){ |
|
172 |
dataHistogram = new CategoricalDataHistogram(feature); |
|
173 |
} |
|
174 |
featureToHistogramMap.put(feature, dataHistogram); |
|
175 |
((CategoricalData) categoricalData).getStateData() |
|
176 |
.forEach(stateData -> featureToHistogramMap.get(feature).addState(stateData.getState())); |
|
177 |
})); |
|
163 |
aggregateCategorcialHistogram(featureToHistogramMap); |
|
178 | 164 |
} |
165 |
|
|
179 | 166 |
}); |
180 | 167 |
} |
168 |
|
|
169 |
@SuppressWarnings("unchecked") |
|
170 |
private void aggregateCategorcialHistogram(Map<Feature, CategoricalDataHistogram> featureToHistogramMap) { |
|
171 |
matrix.getDescriptions() |
|
172 |
.forEach(o -> ((RowWrapperDTO) o).getSpecimenDescription().getElements().stream() |
|
173 |
.filter(descriptionElement -> descriptionElement instanceof CategoricalData) |
|
174 |
.forEach(categoricalData -> { |
|
175 |
Feature feature = ((CategoricalData) categoricalData).getFeature(); |
|
176 |
CategoricalDataHistogram dataHistogram = featureToHistogramMap.get(feature); |
|
177 |
if(dataHistogram==null){ |
|
178 |
dataHistogram = new CategoricalDataHistogram(feature); |
|
179 |
} |
|
180 |
featureToHistogramMap.put(feature, dataHistogram); |
|
181 |
((CategoricalData) categoricalData).getStateData() |
|
182 |
.forEach(stateData -> featureToHistogramMap.get(feature).addState(stateData.getState())); |
|
183 |
})); |
|
184 |
} |
|
185 |
|
|
181 | 186 |
private SpecimenDescription getDescriptionForDescriptiveDataSet(SpecimenOrObservationBase specimen){ |
182 | 187 |
Set<Feature> wsFeatures = matrix.getDescriptiveDataSet().getDescriptiveSystem().getDistinctFeatures(); |
183 | 188 |
List<DescriptionElementBase> matchingDescriptionElements = new ArrayList<>(); |
Also available in: Unified diff
ref #7549 Refactoring