1
|
package eu.etaxonomy.taxeditor.ui.dialog.deleteConfigurator;
|
2
|
|
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;
|
16
|
|
17
|
import eu.etaxonomy.cdm.api.service.config.NameDeletionConfigurator;
|
18
|
import eu.etaxonomy.cdm.api.service.config.TaxonDeletionConfigurator;
|
19
|
/**
|
20
|
* @author kluther
|
21
|
* @date Nov 2, 2015
|
22
|
*
|
23
|
*/
|
24
|
public class DeleteNameConfiguratorComposite extends Composite {
|
25
|
private final DataBindingContext m_bindingContext;
|
26
|
|
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;
|
35
|
|
36
|
/*
|
37
|
* private boolean removeAllNameRelationships = false;
|
38
|
|
39
|
private boolean ignoreIsBasionymFor = false;
|
40
|
|
41
|
private boolean ignoreIsReplacedSynonymFor = false;
|
42
|
|
43
|
private boolean ignoreHasBasionym = true;
|
44
|
|
45
|
private boolean ignoreHasReplacedSynonym = true;
|
46
|
|
47
|
private boolean removeAllNameTypeDesignations = true;
|
48
|
*/
|
49
|
|
50
|
|
51
|
/**
|
52
|
* Create the composite.
|
53
|
* @param parent
|
54
|
* @param style
|
55
|
*/
|
56
|
public DeleteNameConfiguratorComposite(NameDeletionConfigurator configurator, Composite parent, int style) {
|
57
|
super(parent, style);
|
58
|
this.configurator = configurator;
|
59
|
addDisposeListener(new DisposeListener() {
|
60
|
@Override
|
61
|
public void widgetDisposed(DisposeEvent e) {
|
62
|
toolkit.dispose();
|
63
|
}
|
64
|
});
|
65
|
toolkit.paintBordersFor(this);
|
66
|
setLayout(new RowLayout(SWT.VERTICAL));
|
67
|
setBackground(getBackground());
|
68
|
|
69
|
btnRemoveAllNameRelationships = new Button(this, SWT.CHECK);
|
70
|
btnRemoveAllNameRelationships.setText("Remove all Name Relationships");
|
71
|
btnRemoveAllNameRelationships.setSelection(true);
|
72
|
|
73
|
btnIgnoreIsBasionym = new Button(this, SWT.CHECK);
|
74
|
btnIgnoreIsBasionym.setText("Ignore is Basionym");
|
75
|
btnIgnoreIsBasionym.setSelection(true);
|
76
|
|
77
|
btnIgnoreIsReplacedSynonymFor = new Button(this, SWT.CHECK);
|
78
|
btnIgnoreIsReplacedSynonymFor.setText("Ignore is Replaced Synonym");
|
79
|
btnIgnoreIsReplacedSynonymFor.setSelection(true);
|
80
|
|
81
|
btnIgnoreHasBasionym = new Button(this, SWT.CHECK);
|
82
|
btnIgnoreHasBasionym.setText("Ignore has Basionym");
|
83
|
btnIgnoreHasBasionym.setSelection(true);
|
84
|
|
85
|
btnIgnoreHasReplacedSynonym = new Button(this, SWT.CHECK);
|
86
|
btnIgnoreHasReplacedSynonym.setText("Ignore has Replaced Synonym");
|
87
|
btnIgnoreHasReplacedSynonym.setSelection(true);
|
88
|
|
89
|
btnRemoveAllTypeDesignations = new Button(this, SWT.CHECK);
|
90
|
btnRemoveAllTypeDesignations.setText("Remove all Type Designations");
|
91
|
btnRemoveAllTypeDesignations.setSelection(true);
|
92
|
|
93
|
m_bindingContext = initDataBindings();
|
94
|
|
95
|
}
|
96
|
|
97
|
protected DataBindingContext initDataBindings() {
|
98
|
DataBindingContext bindingContext = new DataBindingContext();
|
99
|
//
|
100
|
IObservableValue observeSelectionBtnRemoveAllNameRelationshipsWidget = WidgetProperties.selection().observe(btnRemoveAllNameRelationships);
|
101
|
IObservableValue removeAllNameRelationshipsConfiguratorObserveValue = PojoProperties.value("removeAllNameRelationships").observe(configurator);
|
102
|
bindingContext.bindValue(observeSelectionBtnRemoveAllNameRelationshipsWidget, removeAllNameRelationshipsConfiguratorObserveValue, null, null);
|
103
|
|
104
|
IObservableValue observeSelectionBtnbtnIgnoreIsBasionymObserveWidget = WidgetProperties.selection().observe(btnIgnoreIsBasionym);
|
105
|
IObservableValue ignoreIsBasionymConfiguratorObserveValue = PojoProperties.value("ignoreIsBasionymFor").observe(configurator);
|
106
|
bindingContext.bindValue(observeSelectionBtnbtnIgnoreIsBasionymObserveWidget, ignoreIsBasionymConfiguratorObserveValue, null, null);
|
107
|
|
108
|
IObservableValue observeSelectionBtnIgnoreIsReplacedSynonymForWidget = WidgetProperties.selection().observe(btnIgnoreIsReplacedSynonymFor);
|
109
|
IObservableValue ignoreIsReplacedSynonymForConfiguratorObserveValue = PojoProperties.value("ignoreIsReplacedSynonymFor").observe(configurator);
|
110
|
bindingContext.bindValue(observeSelectionBtnIgnoreIsReplacedSynonymForWidget, ignoreIsReplacedSynonymForConfiguratorObserveValue, null, null);
|
111
|
|
112
|
IObservableValue observeSelectionBtnIgnoreHasBasionymWidget = WidgetProperties.selection().observe(btnIgnoreHasBasionym);
|
113
|
IObservableValue ignoreHasBasionymConfiguratorObserveValue = PojoProperties.value("ignoreHasBasionym").observe(configurator);
|
114
|
bindingContext.bindValue(observeSelectionBtnIgnoreHasBasionymWidget, ignoreHasBasionymConfiguratorObserveValue, null, null);
|
115
|
|
116
|
IObservableValue observeSelectionBtnIgnoreHasReplacedSynonymWidget = WidgetProperties.selection().observe(btnIgnoreHasReplacedSynonym);
|
117
|
IObservableValue ignoreHasReplacedSynonymConfiguratorObserveValue = PojoProperties.value("ignoreHasReplacedSynonym").observe(configurator);
|
118
|
bindingContext.bindValue(observeSelectionBtnIgnoreHasReplacedSynonymWidget, ignoreHasReplacedSynonymConfiguratorObserveValue, null, null);
|
119
|
|
120
|
IObservableValue observeSelectionBtnRemoveAllTypeDesignationsWidget = WidgetProperties.selection().observe(btnRemoveAllTypeDesignations);
|
121
|
IObservableValue removeAllNameTypeDesignationsConfiguratorObserveValue = PojoProperties.value("removeAllNameTypeDesignations").observe(configurator);
|
122
|
bindingContext.bindValue(observeSelectionBtnRemoveAllTypeDesignationsWidget, removeAllNameTypeDesignationsConfiguratorObserveValue, null, null);
|
123
|
|
124
|
//
|
125
|
return bindingContext;
|
126
|
}
|
127
|
}
|