1 package eu
.etaxonomy
.taxeditor
.ui
.dialog
.deleteConfigurator
;
3 import org
.eclipse
.core
.databinding
.DataBindingContext
;
4 import org
.eclipse
.core
.databinding
.beans
.PojoProperties
;
5 import org
.eclipse
.core
.databinding
.observable
.value
.IObservableValue
;
6 import org
.eclipse
.jface
.databinding
.swt
.WidgetProperties
;
7 import org
.eclipse
.swt
.SWT
;
8 import org
.eclipse
.swt
.events
.DisposeEvent
;
9 import org
.eclipse
.swt
.events
.DisposeListener
;
10 import org
.eclipse
.swt
.layout
.RowLayout
;
11 import org
.eclipse
.swt
.widgets
.Button
;
12 import org
.eclipse
.swt
.widgets
.Combo
;
13 import org
.eclipse
.swt
.widgets
.Composite
;
14 import org
.eclipse
.swt
.widgets
.Display
;
15 import org
.eclipse
.ui
.forms
.widgets
.FormToolkit
;
17 import eu
.etaxonomy
.cdm
.api
.service
.config
.NameDeletionConfigurator
;
18 import eu
.etaxonomy
.cdm
.api
.service
.config
.TaxonDeletionConfigurator
;
24 public class DeleteNameConfiguratorComposite
extends Composite
{
25 private final DataBindingContext m_bindingContext
;
27 private final FormToolkit toolkit
= new FormToolkit(Display
.getCurrent());
28 private final NameDeletionConfigurator configurator
;
29 private final Button btnRemoveAllNameRelationships
;
30 private final Button btnIgnoreIsBasionym
;
31 private final Button btnIgnoreIsReplacedSynonymFor
;
32 private final Button btnIgnoreHasBasionym
;
33 private final Button btnIgnoreHasReplacedSynonym
;
34 private final Button btnRemoveAllTypeDesignations
;
37 * private boolean removeAllNameRelationships = false;
39 private boolean ignoreIsBasionymFor = false;
41 private boolean ignoreIsReplacedSynonymFor = false;
43 private boolean ignoreHasBasionym = true;
45 private boolean ignoreHasReplacedSynonym = true;
47 private boolean removeAllNameTypeDesignations = true;
52 * Create the composite.
56 public DeleteNameConfiguratorComposite(NameDeletionConfigurator configurator
, Composite parent
, int style
) {
58 this.configurator
= configurator
;
59 addDisposeListener(new DisposeListener() {
61 public void widgetDisposed(DisposeEvent e
) {
65 toolkit
.paintBordersFor(this);
66 setLayout(new RowLayout(SWT
.VERTICAL
));
67 setBackground(getBackground());
69 btnRemoveAllNameRelationships
= new Button(this, SWT
.CHECK
);
70 btnRemoveAllNameRelationships
.setText("Remove all Name Relationships");
71 btnRemoveAllNameRelationships
.setSelection(true);
73 btnIgnoreIsBasionym
= new Button(this, SWT
.CHECK
);
74 btnIgnoreIsBasionym
.setText("Ignore is Basionym");
75 btnIgnoreIsBasionym
.setSelection(true);
77 btnIgnoreIsReplacedSynonymFor
= new Button(this, SWT
.CHECK
);
78 btnIgnoreIsReplacedSynonymFor
.setText("Ignore is Replaced Synonym");
79 btnIgnoreIsReplacedSynonymFor
.setSelection(true);
81 btnIgnoreHasBasionym
= new Button(this, SWT
.CHECK
);
82 btnIgnoreHasBasionym
.setText("Ignore has Basionym");
83 btnIgnoreHasBasionym
.setSelection(true);
85 btnIgnoreHasReplacedSynonym
= new Button(this, SWT
.CHECK
);
86 btnIgnoreHasReplacedSynonym
.setText("Ignore has Replaced Synonym");
87 btnIgnoreHasReplacedSynonym
.setSelection(true);
89 btnRemoveAllTypeDesignations
= new Button(this, SWT
.CHECK
);
90 btnRemoveAllTypeDesignations
.setText("Remove all Type Designations");
91 btnRemoveAllTypeDesignations
.setSelection(true);
93 m_bindingContext
= initDataBindings();
97 protected DataBindingContext
initDataBindings() {
98 DataBindingContext bindingContext
= new DataBindingContext();
100 IObservableValue observeSelectionBtnRemoveAllNameRelationshipsWidget
= WidgetProperties
.selection().observe(btnRemoveAllNameRelationships
);
101 IObservableValue removeAllNameRelationshipsConfiguratorObserveValue
= PojoProperties
.value("removeAllNameRelationships").observe(configurator
);
102 bindingContext
.bindValue(observeSelectionBtnRemoveAllNameRelationshipsWidget
, removeAllNameRelationshipsConfiguratorObserveValue
, null, null);
104 IObservableValue observeSelectionBtnbtnIgnoreIsBasionymObserveWidget
= WidgetProperties
.selection().observe(btnIgnoreIsBasionym
);
105 IObservableValue ignoreIsBasionymConfiguratorObserveValue
= PojoProperties
.value("ignoreIsBasionymFor").observe(configurator
);
106 bindingContext
.bindValue(observeSelectionBtnbtnIgnoreIsBasionymObserveWidget
, ignoreIsBasionymConfiguratorObserveValue
, null, null);
108 IObservableValue observeSelectionBtnIgnoreIsReplacedSynonymForWidget
= WidgetProperties
.selection().observe(btnIgnoreIsReplacedSynonymFor
);
109 IObservableValue ignoreIsReplacedSynonymForConfiguratorObserveValue
= PojoProperties
.value("ignoreIsReplacedSynonymFor").observe(configurator
);
110 bindingContext
.bindValue(observeSelectionBtnIgnoreIsReplacedSynonymForWidget
, ignoreIsReplacedSynonymForConfiguratorObserveValue
, null, null);
112 IObservableValue observeSelectionBtnIgnoreHasBasionymWidget
= WidgetProperties
.selection().observe(btnIgnoreHasBasionym
);
113 IObservableValue ignoreHasBasionymConfiguratorObserveValue
= PojoProperties
.value("ignoreHasBasionym").observe(configurator
);
114 bindingContext
.bindValue(observeSelectionBtnIgnoreHasBasionymWidget
, ignoreHasBasionymConfiguratorObserveValue
, null, null);
116 IObservableValue observeSelectionBtnIgnoreHasReplacedSynonymWidget
= WidgetProperties
.selection().observe(btnIgnoreHasReplacedSynonym
);
117 IObservableValue ignoreHasReplacedSynonymConfiguratorObserveValue
= PojoProperties
.value("ignoreHasReplacedSynonym").observe(configurator
);
118 bindingContext
.bindValue(observeSelectionBtnIgnoreHasReplacedSynonymWidget
, ignoreHasReplacedSynonymConfiguratorObserveValue
, null, null);
120 IObservableValue observeSelectionBtnRemoveAllTypeDesignationsWidget
= WidgetProperties
.selection().observe(btnRemoveAllTypeDesignations
);
121 IObservableValue removeAllNameTypeDesignationsConfiguratorObserveValue
= PojoProperties
.value("removeAllNameTypeDesignations").observe(configurator
);
122 bindingContext
.bindValue(observeSelectionBtnRemoveAllTypeDesignationsWidget
, removeAllNameTypeDesignationsConfiguratorObserveValue
, null, null);
125 return bindingContext
;