1
|
/**
|
2
|
* Copyright (C) 2020 EDIT
|
3
|
* European Distributed Institute of Taxonomy
|
4
|
* http://www.e-taxonomy.eu
|
5
|
*
|
6
|
* The contents of this file are subject to the Mozilla Public License Version 1.1
|
7
|
* See LICENSE.TXT at the top of this package for the full license terms.
|
8
|
*/
|
9
|
package eu.etaxonomy.taxeditor.ui.dialog.configurator.deleteConfigurator;
|
10
|
|
11
|
import org.eclipse.core.databinding.DataBindingContext;
|
12
|
import org.eclipse.core.databinding.beans.PojoProperties;
|
13
|
import org.eclipse.core.databinding.observable.value.IObservableValue;
|
14
|
import org.eclipse.jface.databinding.swt.WidgetProperties;
|
15
|
import org.eclipse.swt.SWT;
|
16
|
import org.eclipse.swt.events.DisposeEvent;
|
17
|
import org.eclipse.swt.events.DisposeListener;
|
18
|
import org.eclipse.swt.layout.RowLayout;
|
19
|
import org.eclipse.swt.widgets.Button;
|
20
|
import org.eclipse.swt.widgets.Composite;
|
21
|
import org.eclipse.swt.widgets.Display;
|
22
|
import org.eclipse.ui.forms.widgets.FormToolkit;
|
23
|
|
24
|
import eu.etaxonomy.cdm.api.service.config.DeleteDescriptiveDataSetConfigurator;
|
25
|
import eu.etaxonomy.taxeditor.l10n.Messages;
|
26
|
|
27
|
/**
|
28
|
* @author k.luther
|
29
|
* @since Jun 16, 2020
|
30
|
*/
|
31
|
public class DeleteDescriptiveDatasetConfiguratorComposite extends Composite {
|
32
|
private final DataBindingContext m_bindingContext;
|
33
|
|
34
|
private final FormToolkit toolkit = new FormToolkit(Display.getCurrent());
|
35
|
private final DeleteDescriptiveDataSetConfigurator configurator;
|
36
|
private Button btnDeleteAllSpecimenDescriptions;
|
37
|
private Button btnDeleteAllLiteratureDescriptions;
|
38
|
private Button btnDeleteAllDefaultDescriptions;
|
39
|
private Button btnDeleteAllAggregatedDescriptions;
|
40
|
|
41
|
|
42
|
|
43
|
|
44
|
public DeleteDescriptiveDatasetConfiguratorComposite(DeleteDescriptiveDataSetConfigurator configurator, Composite parent, int style) {
|
45
|
super(parent, style);
|
46
|
|
47
|
this.configurator = configurator;
|
48
|
addDisposeListener(new DisposeListener() {
|
49
|
@Override
|
50
|
public void widgetDisposed(DisposeEvent e) {
|
51
|
toolkit.dispose();
|
52
|
}
|
53
|
});
|
54
|
toolkit.paintBordersFor(this);
|
55
|
setLayout(new RowLayout(SWT.VERTICAL));
|
56
|
setBackground(getBackground());
|
57
|
|
58
|
|
59
|
|
60
|
|
61
|
btnDeleteAllSpecimenDescriptions = new Button(this, SWT.CHECK);
|
62
|
btnDeleteAllSpecimenDescriptions.setText(Messages.DeleteConfiguration_descriptiveDataSet_deleteAllSpecimenDesc);
|
63
|
btnDeleteAllSpecimenDescriptions.setEnabled(true);
|
64
|
btnDeleteAllSpecimenDescriptions.setSelection(configurator.isDeleteAllSpecimenDescriptions());
|
65
|
|
66
|
btnDeleteAllDefaultDescriptions = new Button(this, SWT.CHECK);
|
67
|
btnDeleteAllDefaultDescriptions.setText(Messages.DeleteConfiguration_descriptiveDataSet_deleteAllDefaultDesc);
|
68
|
btnDeleteAllDefaultDescriptions.setEnabled(true);
|
69
|
btnDeleteAllDefaultDescriptions.setSelection(configurator.isDeleteAllDefaultDescriptions());
|
70
|
|
71
|
btnDeleteAllLiteratureDescriptions = new Button(this, SWT.CHECK);
|
72
|
btnDeleteAllLiteratureDescriptions.setText(Messages.DeleteConfiguration_descriptiveDataSet_deleteAllLiteratureDesc);
|
73
|
btnDeleteAllLiteratureDescriptions.setEnabled(true);
|
74
|
btnDeleteAllLiteratureDescriptions.setSelection(configurator.isDeleteAllLiteratureDescriptions());
|
75
|
|
76
|
btnDeleteAllAggregatedDescriptions = new Button(this, SWT.CHECK);
|
77
|
btnDeleteAllAggregatedDescriptions.setText(Messages.DeleteConfiguration_descriptiveDataSet_deleteAllAggregatedDesc);
|
78
|
btnDeleteAllAggregatedDescriptions.setEnabled(true);
|
79
|
btnDeleteAllAggregatedDescriptions.setSelection(configurator.isDeleteAllAggregatedDescriptions());
|
80
|
|
81
|
m_bindingContext = initDataBindings();
|
82
|
|
83
|
}
|
84
|
|
85
|
protected DataBindingContext initDataBindings() {
|
86
|
DataBindingContext bindingContext = new DataBindingContext();
|
87
|
|
88
|
IObservableValue observeSelectionBtnDeleteAllSpecimen = WidgetProperties.selection().observe(btnDeleteAllSpecimenDescriptions);
|
89
|
IObservableValue deleteAllSpecimenConfiguratorObserveValue = PojoProperties.value("deleteAllSpecimenDescriptions").observe(configurator);
|
90
|
bindingContext.bindValue(observeSelectionBtnDeleteAllSpecimen, deleteAllSpecimenConfiguratorObserveValue, null, null);
|
91
|
|
92
|
IObservableValue observeSelectionBtnDeleteAllDefault = WidgetProperties.selection().observe(btnDeleteAllDefaultDescriptions);
|
93
|
IObservableValue deleteAlldefaultConfiguratorObserveValue = PojoProperties.value("deleteAllDefaultDescriptions").observe(configurator);
|
94
|
bindingContext.bindValue(observeSelectionBtnDeleteAllDefault, deleteAlldefaultConfiguratorObserveValue, null, null);
|
95
|
|
96
|
IObservableValue observeSelectionBtnDeleteAllLiterature = WidgetProperties.selection().observe(btnDeleteAllLiteratureDescriptions);
|
97
|
IObservableValue deleteAllLiteratureConfiguratorObserveValue = PojoProperties.value("deleteAllLiteratureDescriptions").observe(configurator);
|
98
|
bindingContext.bindValue(observeSelectionBtnDeleteAllLiterature, deleteAllLiteratureConfiguratorObserveValue, null, null);
|
99
|
|
100
|
|
101
|
IObservableValue observeSelectionBtnDeleteAllAggregated = WidgetProperties.selection().observe(btnDeleteAllAggregatedDescriptions);
|
102
|
IObservableValue deleteAllAggregatedConfiguratorObserveValue = PojoProperties.value("deleteAllAggregatedDescriptions").observe(configurator);
|
103
|
bindingContext.bindValue(observeSelectionBtnDeleteAllAggregated, deleteAllAggregatedConfiguratorObserveValue, null, null);
|
104
|
|
105
|
|
106
|
|
107
|
|
108
|
|
109
|
return bindingContext;
|
110
|
}
|
111
|
|
112
|
|
113
|
}
|