Revision 25bd222a
Added by Patrick Plitzner almost 6 years ago
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/descriptiveDataSet/matrix/CharacterMatrixBottomToolbar.java | ||
---|---|---|
15 | 15 |
import java.util.List; |
16 | 16 |
import java.util.Map; |
17 | 17 |
import java.util.Set; |
18 |
import java.util.stream.Collectors; |
|
18 | 19 |
|
19 | 20 |
import org.eclipse.jface.layout.GridDataFactory; |
20 | 21 |
import org.eclipse.jface.window.Window; |
... | ... | |
28 | 29 |
import eu.etaxonomy.cdm.api.service.IDescriptionService; |
29 | 30 |
import eu.etaxonomy.cdm.api.service.IDescriptiveDataSetService; |
30 | 31 |
import eu.etaxonomy.cdm.api.service.IOccurrenceService; |
32 |
import eu.etaxonomy.cdm.api.service.ITaxonNodeService; |
|
31 | 33 |
import eu.etaxonomy.cdm.api.service.dto.RowWrapperDTO; |
32 | 34 |
import eu.etaxonomy.cdm.model.description.CategoricalData; |
33 | 35 |
import eu.etaxonomy.cdm.model.description.DescriptionElementBase; |
... | ... | |
35 | 37 |
import eu.etaxonomy.cdm.model.description.QuantitativeData; |
36 | 38 |
import eu.etaxonomy.cdm.model.description.SpecimenDescription; |
37 | 39 |
import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase; |
40 |
import eu.etaxonomy.cdm.model.taxon.TaxonNode; |
|
38 | 41 |
import eu.etaxonomy.cdm.persistence.dto.SpecimenNodeWrapper; |
42 |
import eu.etaxonomy.cdm.persistence.dto.TaxonNodeDto; |
|
43 |
import eu.etaxonomy.cdm.persistence.dto.UuidAndTitleCache; |
|
39 | 44 |
import eu.etaxonomy.taxeditor.editor.l10n.Messages; |
40 | 45 |
import eu.etaxonomy.taxeditor.model.DescriptionHelper; |
41 | 46 |
import eu.etaxonomy.taxeditor.model.ImageResources; |
42 | 47 |
import eu.etaxonomy.taxeditor.model.MessagingUtils; |
43 | 48 |
import eu.etaxonomy.taxeditor.store.CdmStore; |
49 |
import eu.etaxonomy.taxeditor.ui.dialog.selection.TaxonNodeSelectionDialog; |
|
44 | 50 |
|
45 | 51 |
/** |
46 | 52 |
* @author pplitzner |
... | ... | |
116 | 122 |
}); |
117 | 123 |
} |
118 | 124 |
}); |
125 |
/** |
|
126 |
* Aggregate button |
|
127 |
*/ |
|
128 |
Button btnAggregate = new Button(this, SWT.PUSH); |
|
129 |
// btnAggregate.setImage(ImageResources.getImage(ImageResources.ACTIVE_DELETE_ICON)); |
|
130 |
btnAggregate.setText("Aggregate"); |
|
131 |
btnAggregate.addSelectionListener(new SelectionAdapter() { |
|
132 |
@Override |
|
133 |
public void widgetSelected(SelectionEvent e) { |
|
134 |
Set<TaxonNode> taxonSubtreeFilter = matrix.getDescriptiveDataSet().getTaxonSubtreeFilter(); |
|
135 |
List<TaxonNodeDto> nodeDtos = taxonSubtreeFilter.stream() |
|
136 |
.map(node -> new TaxonNodeDto(node)).collect(Collectors.toList()); |
|
137 |
TaxonNodeDto parentDto = CdmStore.getService(ITaxonNodeService.class).findCommonParentDto(nodeDtos); |
|
138 |
UuidAndTitleCache<TaxonNode> parentNodeUuidAndTitleCache = TaxonNodeSelectionDialog.selectUuidAndTitleCache( |
|
139 |
getShell(), |
|
140 |
"Select taxon node for aggregated description", |
|
141 |
null, |
|
142 |
null, |
|
143 |
parentDto.getClassificationUUID()); |
|
144 |
CdmStore.getService(IDescriptionService.class).aggregateDescription(parentDto.getTaxonUuid(), null, matrix.getDescriptiveDataSet().getUuid()); |
|
145 |
matrix.setDirty(); |
|
146 |
|
|
147 |
} |
|
148 |
}); |
|
149 |
btnAggregate.setVisible(false); |
|
150 |
btnAggregate.setEnabled(false); |
|
119 | 151 |
|
120 | 152 |
} |
121 | 153 |
private SpecimenDescription getDescriptionForDescriptiveDataSet(SpecimenOrObservationBase specimen){ |
Also available in: Unified diff
ref #7509 Add prototype aggregation function to character matrix