import eu.etaxonomy.cdm.api.service.description.AggregationSourceMode;
import eu.etaxonomy.cdm.api.service.description.DescriptionAggregationBase;
import eu.etaxonomy.cdm.api.service.description.DescriptionAggregationConfigurationBase;
+import eu.etaxonomy.cdm.filter.LogicFilter;
import eu.etaxonomy.cdm.model.name.Rank;
import eu.etaxonomy.cdm.model.name.TaxonName;
import eu.etaxonomy.cdm.model.reference.OriginalSourceType;
comboHigherRank.add(rank.getLabel());
comboHigherRank.setData(rank.getLabel(), rank);
}
+
}
protected void updateLowerRankCombo() {
}
rankList.sort(comparator);
for (Rank rank: rankList){
- comboLowerRank.add(rank.getLabel());
- comboLowerRank.setData(rank.getLabel(), rank);
+ comboLowerRank.add(rank.getLabel());
+ comboLowerRank.setData(rank.getLabel(), rank);
}
}
public EnumSet<OriginalSourceType> getSourceTypes(){
List<OriginalSourceType> list = new ArrayList<>();
+ if (sourceTypeViewer == null) return null;
for (Object o: sourceTypeViewer.getCheckedElements()){
String string = null;
if (o instanceof String){
}
return result;
}
+
+ protected void setConfigValueToRankCombo(Combo rankCombo) {
+ int index = 0;
+ if (configurator.getTaxonNodeFilter().getRankMax() == null){
+ rankCombo.select(index);
+ }else{
+ Rank rank = null;
+ for (String item: rankCombo.getItems()){
+ if (rankCombo.getData(item) instanceof Rank){
+ rank = (Rank) rankCombo.getData(item);
+ if (rank.getUuid().equals(configurator.getTaxonNodeFilter().getRankMax().getUuid())){
+ rankCombo.select(index);
+ break;
+ }
+ }
+ index++;
+ }
+ }
+ }
+
}
\ No newline at end of file
import eu.etaxonomy.cdm.api.service.description.DistributionAggregationConfiguration;
import eu.etaxonomy.cdm.filter.LogicFilter;
import eu.etaxonomy.cdm.model.location.NamedAreaLevel;
+import eu.etaxonomy.cdm.model.name.Rank;
import eu.etaxonomy.cdm.model.reference.OriginalSourceType;
import eu.etaxonomy.cdm.model.taxon.Classification;
import eu.etaxonomy.cdm.model.taxon.TaxonNode;
comboHigherRank = new Combo(control, SWT.BORDER | SWT.READ_ONLY);
updateHigherRankCombo();
+ setConfigValueToRankCombo(comboHigherRank);
comboHigherRank.addListener(SWT.Selection, this);
Label lowerRankLabel = new Label(control, SWT.NULL);
lowerRankLabel.setText(Messages.DistributionAggregationWizardPage_LOWEST_RANK);
comboLowerRank = new Combo(control, SWT.BORDER | SWT.READ_ONLY);
updateLowerRankCombo();
+
+ setConfigValueToRankCombo(comboLowerRank);
comboLowerRank.addListener(SWT.Selection, this);
separator = new Label(composite, SWT.HORIZONTAL | SWT.SEPARATOR);
setControl(composite);
}
+
@Override
public void widgetSelected(SelectionEvent e) {
// }
TaxonNodeFilter filter = configurator.getTaxonNodeFilter();
if (!page.useHigherLevel()) {
- UUID minRankUuid = dataSet.getMinRank() != null? dataSet.getMinRank().getUuid(): null;
- UUID maxRankUuid = dataSet.getMinRank() != null? dataSet.getMaxRank().getUuid(): null;
+ UUID minRankUuid = null;
+ UUID maxRankUuid = null;
+ if (page.getHigherRank() != null){
+ maxRankUuid = page.getHigherRank().getUuid();
+ }else{
+ maxRankUuid = dataSet.getMaxRank() != null? dataSet.getMaxRank().getUuid(): null;
+
+ }
+ if (page.getLowerRank() != null){
+ minRankUuid = page.getLowerRank().getUuid();
+ }else{
+ minRankUuid = dataSet.getMinRank() != null? dataSet.getMinRank().getUuid(): null;
+ }
filter.setRankMax(maxRankUuid);
filter.setRankMin(minRankUuid);
import eu.etaxonomy.cdm.api.service.description.AggregationType;
import eu.etaxonomy.cdm.api.service.description.StructuredDescriptionAggregation;
import eu.etaxonomy.cdm.api.service.description.StructuredDescriptionAggregationConfiguration;
+import eu.etaxonomy.cdm.model.name.Rank;
import eu.etaxonomy.cdm.model.reference.OriginalSourceType;
import eu.etaxonomy.cdm.model.taxon.TaxonNode;
+import eu.etaxonomy.cdm.persistence.dto.DescriptiveDataSetBaseDto;
import eu.etaxonomy.cdm.persistence.dto.TaxonNodeDto;
import eu.etaxonomy.taxeditor.l10n.Messages;
import eu.etaxonomy.taxeditor.ui.combo.OriginalSourceTypeComparator;
protected Button checkIncludeDefaultDescriptions;
protected Button checkIncludeLiteratureDescriptions;
+ protected DescriptiveDataSetBaseDto ddsDTO;
+
private Label selectSubtreeLabel;
this.configurator = configurator;
this.setDescription(Messages.DistributionAggregationWizardPage_DESCRIPTION);
selectedNodes = nodes;
+ ddsDTO = CdmApplicationState.getCurrentAppConfig().getDescriptiveDataSetService().getDescriptiveDataSetDtoByUuid(configurator.getDatasetUuid());
+
}
@Override
}
}
});
+
// ... from selected subtree
checkUseSelectedSubtree= new Button(radioComposite, SWT.RADIO);
comboHigherRank = new Combo(control, SWT.BORDER | SWT.READ_ONLY);
updateHigherRankCombo();
+ setConfigValueToRankCombo(comboHigherRank, ddsDTO.getMaxRank().getUuid());
comboHigherRank.addListener(SWT.Selection, this);
Label lowerRankLabel = new Label(control, SWT.NULL);
lowerRankLabel.setText(Messages.DistributionAggregationWizardPage_LOWEST_RANK);
comboLowerRank = new Combo(control, SWT.BORDER | SWT.READ_ONLY);
updateLowerRankCombo();
+ setConfigValueToRankCombo(comboLowerRank, ddsDTO.getMinRank().getUuid());
comboLowerRank.addListener(SWT.Selection, this);
//aggregation mode viewer
comboSourceModeChildParent.addListener(SWT.Selection, this);
GridLayoutFactory.fillDefaults();
- //source type
+ /*source type
//TODO: distinguish within taxon and parent child source types
Label sourceTypeLabel = new Label(control, SWT.NULL);
sourceTypeLabel.setText(Messages.DistributionAggregationWizardPage_SOURCE_TYPE);
sourceTypeViewer.setChecked(OriginalSourceType.PrimaryMediaSource.getLabel(), true);
sourceTypeViewer.setChecked(OriginalSourceType.PrimaryTaxonomicSource.getLabel(), true);
sourceTypeViewer.getTable().setEnabled(false);
+ */
setControl(control);
}
}
if (event.widget.equals(this.comboSourceModeChildParent) || event.widget.equals(this.comboSourceModeWithinTaxon)){
- if (getSourceModeChildParent().equals(AggregationSourceMode.NONE) && getSourceModeWithinTaxon().equals(AggregationSourceMode.NONE)){
- sourceTypeViewer.getTable().setEnabled(false);
- }else {
- sourceTypeViewer.getTable().setEnabled(true);
- }
+// if (getSourceModeChildParent().equals(AggregationSourceMode.NONE) && getSourceModeWithinTaxon().equals(AggregationSourceMode.NONE)){
+// sourceTypeViewer.getTable().setEnabled(false);
+// }else {
+// sourceTypeViewer.getTable().setEnabled(true);
+// }
}
}
}
return result;
}
+
+ protected void setConfigValueToRankCombo(Combo rankCombo, UUID rankUuid) {
+ int index = 0;
+
+ if (rankUuid == null){
+ rankCombo.select(index);
+ }else{
+ Rank rank = null;
+ for (String item: rankCombo.getItems()){
+ if (rankCombo.getData(item) instanceof Rank){
+ rank = (Rank) rankCombo.getData(item);
+ if (rank.getUuid().equals(rankUuid)){
+ rankCombo.select(index);
+ break;
+ }
+ }
+ index++;
+ }
+ }
+ }
}
\ No newline at end of file