Project

General

Profile

« Previous | Next » 

Revision 41883468

Added by Patrick Plitzner almost 6 years ago

ref #7549 Implement historgram tooltip for categorical data

View differences:

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")
133 134
            @Override
134 135
            public void widgetSelected(SelectionEvent e) {
135 136
                Set<TaxonNode> taxonSubtreeFilter = matrix.getDescriptiveDataSet().getTaxonSubtreeFilter();
......
157 158
                matrix.addUpdateResult(result);
158 159
                matrix.setDirty();
159 160

  
161
                //aggregate histogram for categorical tooltip
162
                Map<Feature, CategoricalDataHistogram> featureToHistogramMap = matrix.getFeatureToHistogramMap();
163
                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
                                }));
160 178
            }
161 179
        });
162

  
163 180
    }
164 181
    private SpecimenDescription getDescriptionForDescriptiveDataSet(SpecimenOrObservationBase specimen){
165 182
        Set<Feature> wsFeatures = matrix.getDescriptiveDataSet().getDescriptiveSystem().getDistinctFeatures();

Also available in: Unified diff