+package eu.etaxonomy.taxeditor.ui.dialog.deleteConfigurator;
+
+import org.eclipse.core.databinding.DataBindingContext;
+import org.eclipse.core.databinding.beans.PojoProperties;
+import org.eclipse.core.databinding.observable.value.IObservableValue;
+import org.eclipse.jface.databinding.swt.WidgetProperties;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.DisposeEvent;
+import org.eclipse.swt.events.DisposeListener;
+import org.eclipse.swt.layout.RowLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Combo;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.forms.widgets.FormToolkit;
+
+import eu.etaxonomy.cdm.api.service.config.NameDeletionConfigurator;
+import eu.etaxonomy.cdm.api.service.config.TaxonDeletionConfigurator;
+/**
+ * @author kluther
+ * @date Nov 2, 2015
+ *
+ */
+public class DeleteNameConfiguratorComposite extends Composite {
+ private final DataBindingContext m_bindingContext;
+
+ private final FormToolkit toolkit = new FormToolkit(Display.getCurrent());
+ private final NameDeletionConfigurator configurator;
+ private final Button btnRemoveAllNameRelationships;
+ private final Button btnIgnoreIsBasionym;
+ private final Button btnIgnoreIsReplacedSynonymFor;
+ private final Button btnIgnoreHasBasionym;
+ private final Button btnIgnoreHasReplacedSynonym;
+ private final Button btnRemoveAllTypeDesignations;
+
+ /*
+ * private boolean removeAllNameRelationships = false;
+
+ private boolean ignoreIsBasionymFor = false;
+
+ private boolean ignoreIsReplacedSynonymFor = false;
+
+ private boolean ignoreHasBasionym = true;
+
+ private boolean ignoreHasReplacedSynonym = true;
+
+ private boolean removeAllNameTypeDesignations = true;
+ */
+
+
+ /**
+ * Create the composite.
+ * @param parent
+ * @param style
+ */
+ public DeleteNameConfiguratorComposite(NameDeletionConfigurator configurator, Composite parent, int style) {
+ super(parent, style);
+ this.configurator = configurator;
+ addDisposeListener(new DisposeListener() {
+ @Override
+ public void widgetDisposed(DisposeEvent e) {
+ toolkit.dispose();
+ }
+ });
+ toolkit.paintBordersFor(this);
+ setLayout(new RowLayout(SWT.VERTICAL));
+ setBackground(getBackground());
+
+ btnRemoveAllNameRelationships = new Button(this, SWT.CHECK);
+ btnRemoveAllNameRelationships.setText("Remove all Name Relationships");
+ btnRemoveAllNameRelationships.setSelection(true);
+
+ btnIgnoreIsBasionym = new Button(this, SWT.CHECK);
+ btnIgnoreIsBasionym.setText("Ignore is Basionym");
+ btnIgnoreIsBasionym.setSelection(true);
+
+ btnIgnoreIsReplacedSynonymFor = new Button(this, SWT.CHECK);
+ btnIgnoreIsReplacedSynonymFor.setText("Ignore is Replaced Synonym");
+ btnIgnoreIsReplacedSynonymFor.setSelection(true);
+
+ btnIgnoreHasBasionym = new Button(this, SWT.CHECK);
+ btnIgnoreHasBasionym.setText("Ignore has Basionym");
+ btnIgnoreHasBasionym.setSelection(true);
+
+ btnIgnoreHasReplacedSynonym = new Button(this, SWT.CHECK);
+ btnIgnoreHasReplacedSynonym.setText("Ignore has Replaced Synonym");
+ btnIgnoreHasReplacedSynonym.setSelection(true);
+
+ btnRemoveAllTypeDesignations = new Button(this, SWT.CHECK);
+ btnRemoveAllTypeDesignations.setText("Remove all Type Designations");
+ btnRemoveAllTypeDesignations.setSelection(true);
+
+ m_bindingContext = initDataBindings();
+
+ }
+
+ protected DataBindingContext initDataBindings() {
+ DataBindingContext bindingContext = new DataBindingContext();
+ //
+ IObservableValue observeSelectionBtnRemoveAllNameRelationshipsWidget = WidgetProperties.selection().observe(btnRemoveAllNameRelationships);
+ IObservableValue removeAllNameRelationshipsConfiguratorObserveValue = PojoProperties.value("removeAllNameRelationships").observe(configurator);
+ bindingContext.bindValue(observeSelectionBtnRemoveAllNameRelationshipsWidget, removeAllNameRelationshipsConfiguratorObserveValue, null, null);
+
+ IObservableValue observeSelectionBtnbtnIgnoreIsBasionymObserveWidget = WidgetProperties.selection().observe(btnIgnoreIsBasionym);
+ IObservableValue ignoreIsBasionymConfiguratorObserveValue = PojoProperties.value("ignoreIsBasionymFor").observe(configurator);
+ bindingContext.bindValue(observeSelectionBtnbtnIgnoreIsBasionymObserveWidget, ignoreIsBasionymConfiguratorObserveValue, null, null);
+
+ IObservableValue observeSelectionBtnIgnoreIsReplacedSynonymForWidget = WidgetProperties.selection().observe(btnIgnoreIsReplacedSynonymFor);
+ IObservableValue ignoreIsReplacedSynonymForConfiguratorObserveValue = PojoProperties.value("ignoreIsReplacedSynonymFor").observe(configurator);
+ bindingContext.bindValue(observeSelectionBtnIgnoreIsReplacedSynonymForWidget, ignoreIsReplacedSynonymForConfiguratorObserveValue, null, null);
+
+ IObservableValue observeSelectionBtnIgnoreHasBasionymWidget = WidgetProperties.selection().observe(btnIgnoreHasBasionym);
+ IObservableValue ignoreHasBasionymConfiguratorObserveValue = PojoProperties.value("ignoreHasBasionym").observe(configurator);
+ bindingContext.bindValue(observeSelectionBtnIgnoreHasBasionymWidget, ignoreHasBasionymConfiguratorObserveValue, null, null);
+
+ IObservableValue observeSelectionBtnIgnoreHasReplacedSynonymWidget = WidgetProperties.selection().observe(btnIgnoreHasReplacedSynonym);
+ IObservableValue ignoreHasReplacedSynonymConfiguratorObserveValue = PojoProperties.value("ignoreHasReplacedSynonym").observe(configurator);
+ bindingContext.bindValue(observeSelectionBtnIgnoreHasReplacedSynonymWidget, ignoreHasReplacedSynonymConfiguratorObserveValue, null, null);
+
+ IObservableValue observeSelectionBtnRemoveAllTypeDesignationsWidget = WidgetProperties.selection().observe(btnRemoveAllTypeDesignations);
+ IObservableValue removeAllNameTypeDesignationsConfiguratorObserveValue = PojoProperties.value("removeAllNameTypeDesignations").observe(configurator);
+ bindingContext.bindValue(observeSelectionBtnRemoveAllTypeDesignationsWidget, removeAllNameTypeDesignationsConfiguratorObserveValue, null, null);
+
+ //
+ return bindingContext;
+ }
+}