*/
package eu.etaxonomy.taxeditor.ui.dialog.deleteConfigurator;
+import java.util.List;
+
import org.eclipse.core.databinding.DataBindingContext;
import org.eclipse.core.databinding.beans.PojoProperties;
import org.eclipse.core.databinding.observable.value.IObservableValue;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.DisposeEvent;
import org.eclipse.swt.events.DisposeListener;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
+
import org.eclipse.swt.layout.RowLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Combo;
import org.eclipse.swt.widgets.Label;
import org.eclipse.ui.forms.widgets.FormToolkit;
+import eu.etaxonomy.cdm.api.service.IClassificationService;
import eu.etaxonomy.cdm.api.service.config.TaxonDeletionConfigurator;
-import eu.etaxonomy.cdm.common.CdmUtils;
+
import eu.etaxonomy.cdm.model.taxon.Classification;
+import eu.etaxonomy.taxeditor.store.CdmStore;
/**
* @date Feb 18, 2015
*
*/
-public class DeleteTaxonConfiguratorComposite extends Composite {
+public class DeleteTaxonConfiguratorComposite extends Composite implements SelectionListener{
private final DataBindingContext m_bindingContext;
private final FormToolkit toolkit = new FormToolkit(Display.getCurrent());
private final Button btnDeleteTaxonName;
private final Button btnDeleteInAllClassifications;
private Combo classificationSelectionCombo;
-
+ private
+
+ Classification selectedClassification;
+ private List<Classification> classifications;
/**
}
});
toolkit.paintBordersFor(this);
- setLayout(new RowLayout(SWT.VERTICAL));
+ setLayout(new GridLayout());
setBackground(getBackground());
btnDeleteTaxonName = new Button(this, SWT.CHECK);
btnDeleteInAllClassifications.setText("Delete taxon in all classifications");
btnDeleteInAllClassifications.setSelection(true);
+ // createClassificationSelectionCombo(this);
+
m_bindingContext = initDataBindings();
}
IObservableValue deleteInAllClassificationsConfiguratorObserveValue = PojoProperties.value("deleteInAllClassifications").observe(configurator);
bindingContext.bindValue(observeSelectionBtnDeleteTaxonNameObserveWidget, deleteNameIfPossibleConfiguratorObserveValue, null, null);
bindingContext.bindValue(observeSelectionBtnDeleteInAllClassificationObserveWidget, deleteInAllClassificationsConfiguratorObserveValue, null, null);
+
+
+
//
return bindingContext;
}
- /* private Control createClassificationSelectionCombo(Composite parent){
+ /* private Control createClassificationSelectionCombo(Composite parent){
// classifications = CdmStore.getTaxonTreeService().list(null, null, null, null, null);
Composite classificationSelection = new Composite(parent, SWT.NULL);
- classificationSelection.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false));
+ classificationSelection.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, true));
GridLayout layout = new GridLayout();
classificationSelection.setLayout(layout);
label.setText("Select Classification");
classificationSelectionCombo = new Combo(classificationSelection, SWT.BORDER | SWT.READ_ONLY);
classificationSelectionCombo.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, true));
- List<Classification> classifications =
+ classifications = CdmStore.getService(IClassificationService.class).list(null, null, null, null, null);
for(Classification tree : classifications){
classificationSelectionCombo.add(tree.getName().getText(), classifications.indexOf(tree));
}
- classificationSelectionCombo.select(classifications.indexOf(selectedClassification));
-
- // TODO remember last selection
+ classificationSelectionCombo.select(0);
classificationSelectionCombo.addSelectionListener(this);
-
-
-
+
return classificationSelection;
}*/
+
+@Override
+public void widgetSelected(SelectionEvent e) {
+ selectedClassification = classifications.get(classificationSelectionCombo.getSelectionIndex());
+}
+
+@Override
+public void widgetDefaultSelected(SelectionEvent e) {
+ // TODO Auto-generated method stub
+
+}
}