Revision f8c40685
Added by Katja Luther almost 4 years ago
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/configurator/StructuredDescriptionAggregationConfigurationWizardPage.java | ||
---|---|---|
32 | 32 |
import eu.etaxonomy.cdm.api.application.CdmApplicationState; |
33 | 33 |
import eu.etaxonomy.cdm.api.service.description.AggregationMode; |
34 | 34 |
import eu.etaxonomy.cdm.api.service.description.AggregationSourceMode; |
35 |
import eu.etaxonomy.cdm.api.service.description.AggregationType; |
|
35 | 36 |
import eu.etaxonomy.cdm.api.service.description.StructuredDescriptionAggregation; |
36 | 37 |
import eu.etaxonomy.cdm.api.service.description.StructuredDescriptionAggregationConfiguration; |
37 | 38 |
import eu.etaxonomy.cdm.model.reference.OriginalSourceType; |
38 | 39 |
import eu.etaxonomy.cdm.model.taxon.TaxonNode; |
40 |
import eu.etaxonomy.cdm.persistence.dto.TaxonNodeDto; |
|
39 | 41 |
import eu.etaxonomy.taxeditor.l10n.Messages; |
40 | 42 |
import eu.etaxonomy.taxeditor.ui.combo.OriginalSourceTypeComparator; |
41 | 43 |
|
... | ... | |
46 | 48 |
public class StructuredDescriptionAggregationConfigurationWizardPage extends AggregationConfigurationWizardPage<StructuredDescriptionAggregation> implements Listener { |
47 | 49 |
|
48 | 50 |
protected CheckboxTableViewer subTreeSelectionViewer; |
51 |
private List<TaxonNodeDto> selectedNodes; |
|
52 |
|
|
49 | 53 |
|
50 | 54 |
|
51 | 55 |
/** |
52 | 56 |
* @param pageName |
53 | 57 |
*/ |
54 |
protected StructuredDescriptionAggregationConfigurationWizardPage(StructuredDescriptionAggregationConfiguration configurator) { |
|
58 |
protected StructuredDescriptionAggregationConfigurationWizardPage(StructuredDescriptionAggregationConfiguration configurator, List<TaxonNodeDto> nodes) {
|
|
55 | 59 |
super(Messages.DistributionAggregationWizardPage_TITLE); |
56 | 60 |
this.configurator = configurator; |
57 |
|
|
58 | 61 |
this.setDescription(Messages.DistributionAggregationWizardPage_DESCRIPTION); |
62 |
selectedNodes = nodes; |
|
59 | 63 |
} |
60 | 64 |
|
61 | 65 |
|
... | ... | |
70 | 74 |
control.setLayoutData(new GridData(SWT.FILL, SWT.LEFT, true, true)); |
71 | 75 |
|
72 | 76 |
//select between taxonnode filter for the whole descriptive dataset or the selected taxonnode/subtree |
73 |
|
|
74 |
|
|
75 | 77 |
GridData gridDataRadioComposite = new GridData(); |
76 | 78 |
gridDataRadioComposite.horizontalSpan = 2; |
77 | 79 |
GridLayout gridLayoutRadioComposite = new GridLayout(); |
... | ... | |
95 | 97 |
}); |
96 | 98 |
|
97 | 99 |
checkUseSelectedTaxonNode= new Button(radioComposite, SWT.RADIO); |
98 |
checkUseSelectedTaxonNode.setText(Messages.AggregationWizardPage_SINGLE_TAXON);
|
|
100 |
checkUseSelectedTaxonNode.setText(Messages.StructuredDescriptionAggregationWizardPage_SELECT_SELECTED_TAXA_ONLY);
|
|
99 | 101 |
checkUseSelectedTaxonNode.addListener(SWT.Selection, new Listener() { |
100 | 102 |
@Override |
101 | 103 |
public void handleEvent(Event e) { |
... | ... | |
110 | 112 |
|
111 | 113 |
}); |
112 | 114 |
|
115 |
// configurator.getTaxonNodeFilter().getSubtreeFilter().stream().forEach(p ->uuidList.add(p.getUuid())); |
|
116 |
// List<String> propertyPaths = new ArrayList<>(); |
|
117 |
// propertyPaths.add("taxon.name"); |
|
118 |
// List<TaxonNode> nodeList = CdmApplicationState.getCurrentAppConfig().getTaxonNodeService().load(uuidList, propertyPaths); |
|
119 |
|
|
113 | 120 |
Label selectSubtreeLabel = new Label(control, SWT.NULL); |
114 | 121 |
selectSubtreeLabel.setText(Messages.StructuredDescriptionAggregationWizardPage_SELECT_SUBTREE); |
115 | 122 |
selectSubtreeLabel.setToolTipText(Messages.StructuredDescriptionAggregationWizardPage_TOOLTIP_SELECT_SUBTREE); |
... | ... | |
121 | 128 |
subTreeSelectionViewer.setLabelProvider(new LabelProvider(){ |
122 | 129 |
@Override |
123 | 130 |
public String getText(Object element){ |
124 |
if (element instanceof TaxonNode){ |
|
125 |
return ((TaxonNode)element).getTaxon().getName().getTitleCache(); |
|
131 |
if (element instanceof TaxonNodeDto){ |
|
132 |
return ((TaxonNodeDto)element).getNameTitleCache(); |
|
133 |
}else if (element instanceof TaxonNode){ |
|
134 |
return ((TaxonNode)element).getTaxon().getName().getTitleCache(); |
|
126 | 135 |
} |
127 | 136 |
return null; |
128 | 137 |
} |
129 | 138 |
|
130 | 139 |
}); |
131 | 140 |
|
132 |
List<TaxonNode> nodeList; |
|
133 |
List<UUID> uuidList = new ArrayList<>(); |
|
134 |
configurator.getTaxonNodeFilter().getSubtreeFilter().stream().forEach(p ->uuidList.add(p.getUuid())); |
|
135 |
List<String> propertyPaths = new ArrayList<>(); |
|
136 |
propertyPaths.add("taxon.name"); |
|
137 |
nodeList = CdmApplicationState.getCurrentAppConfig().getTaxonNodeService().load(uuidList, propertyPaths); |
|
138 | 141 |
|
139 |
subTreeSelectionViewer.setInput(nodeList); |
|
142 |
|
|
143 |
|
|
144 |
if (selectedNodes == null || selectedNodes.isEmpty()){ |
|
145 |
List<TaxonNode> nodeList; |
|
146 |
List<UUID> uuidList = new ArrayList<>(); |
|
147 |
configurator.getTaxonNodeFilter().getSubtreeFilter().stream().forEach(p ->uuidList.add(p.getUuid())); |
|
148 |
List<String> propertyPaths = new ArrayList<>(); |
|
149 |
propertyPaths.add("taxon.name"); |
|
150 |
nodeList = CdmApplicationState.getCurrentAppConfig().getTaxonNodeService().load(uuidList, propertyPaths); |
|
151 |
|
|
152 |
subTreeSelectionViewer.setInput(nodeList); |
|
153 |
|
|
154 |
}else{ |
|
155 |
subTreeSelectionViewer.setInput(selectedNodes); |
|
156 |
} |
|
140 | 157 |
subTreeSelectionViewer.setAllChecked(true); |
141 | 158 |
subTreeSelectionViewer.addCheckStateListener(new ICheckStateListener(){ |
142 | 159 |
@Override |
... | ... | |
153 | 170 |
|
154 | 171 |
//use taxonnode filter of the descriptive data set |
155 | 172 |
checkUseHigherLevel = new Button(radioComposite, SWT.RADIO); |
156 |
checkUseHigherLevel.setText("Use all subtrees included in descriptive data set");
|
|
173 |
checkUseHigherLevel.setText(Messages.StructuredDescriptionAggregationWizardPage_SELECT_ALL_SUBTREES);
|
|
157 | 174 |
checkUseHigherLevel.addListener(SWT.Selection, new Listener() { |
158 | 175 |
@Override |
159 | 176 |
public void handleEvent(Event e) { |
177 |
subTreeSelectionViewer.getTable().setEnabled(!checkUseHigherLevel.getSelection()); |
|
160 | 178 |
updateHigherRankCombo(); |
161 | 179 |
if (checkUseHigherLevel.getSelection()){ |
162 | 180 |
setPageComplete(true); |
... | ... | |
238 | 256 |
comboSourceModeWithinTaxon = new Combo(control, SWT.BORDER| SWT.READ_ONLY); |
239 | 257 |
comboSourceModeWithinTaxon.setText(Messages.DistributionAggregationWizardPage_AGGREGATION_MODE); |
240 | 258 |
|
241 |
for (AggregationSourceMode mode :AggregationSourceMode.values()){
|
|
259 |
for (AggregationSourceMode mode :AggregationSourceMode.list(AggregationMode.WithinTaxon, AggregationType.StructuredDescription) ){
|
|
242 | 260 |
comboSourceModeWithinTaxon.add(mode.getMessage()); |
243 | 261 |
comboSourceModeWithinTaxon.setData(mode.getMessage(), mode); |
244 | 262 |
|
... | ... | |
255 | 273 |
comboSourceModeChildParent = new Combo(control, SWT.BORDER| SWT.READ_ONLY); |
256 | 274 |
comboSourceModeChildParent.setText(Messages.DistributionAggregationWizardPage_AGGREGATION_MODE); |
257 | 275 |
|
258 |
for (AggregationSourceMode mode :AggregationSourceMode.values()){
|
|
276 |
for (AggregationSourceMode mode :AggregationSourceMode.list(AggregationMode.ToParent, AggregationType.StructuredDescription) ){
|
|
259 | 277 |
comboSourceModeChildParent.add(mode.getMessage()); |
260 | 278 |
comboSourceModeChildParent.setData(mode.getMessage(), mode); |
261 | 279 |
|
Also available in: Unified diff
ref #8785: adapt aggregation wizard, add aggregation to context mennu