2 * Copyright (C) 2015 EDIT
3 * European Distributed Institute of Taxonomy
4 * http://www.e-taxonomy.eu
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.
9 package eu
.etaxonomy
.taxeditor
.ui
.dialog
.deleteConfigurator
;
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
;
24 import eu
.etaxonomy
.cdm
.api
.service
.config
.SpecimenDeleteConfigurator
;
31 public class DeleteSpecimenConfiguratorComposite
extends Composite
{
32 private final DataBindingContext m_bindingContext
;
34 private final FormToolkit toolkit
= new FormToolkit(Display
.getCurrent());
36 private final SpecimenDeleteConfigurator configurator
;
37 private final Button btnDeleteChildren
;
38 private final Button btnDeleteFromTypeDesignation
;
39 private final Button btnDeleteIndividualsassociationsfactual
;
40 private final Button btnDeleteSpecimenDescription
;
43 * Create the composite.
47 public DeleteSpecimenConfiguratorComposite(SpecimenDeleteConfigurator configurator
, Composite parent
, int style
) {
49 this.configurator
= configurator
;
50 addDisposeListener(new DisposeListener() {
52 public void widgetDisposed(DisposeEvent e
) {
56 toolkit
.paintBordersFor(this);
57 setLayout(new RowLayout(SWT
.VERTICAL
));
59 btnDeleteChildren
= new Button(this, SWT
.CHECK
);
60 btnDeleteChildren
.setText("Delete Children");
62 btnDeleteFromTypeDesignation
= new Button(this, SWT
.CHECK
);
63 btnDeleteFromTypeDesignation
.setText("Delete from type designations");
65 btnDeleteIndividualsassociationsfactual
= new Button(this, SWT
.CHECK
);
66 btnDeleteIndividualsassociationsfactual
.setText("Delete from factual data");
68 btnDeleteSpecimenDescription
= new Button(this, SWT
.CHECK
);
69 btnDeleteSpecimenDescription
.setText("Delete from \"Described specimen\" in taxon descriptions");
70 m_bindingContext
= initDataBindings();
73 protected DataBindingContext
initDataBindings() {
74 DataBindingContext bindingContext
= new DataBindingContext();
76 IObservableValue observeSelectionBtnDeleteChildrenObserveWidget
= WidgetProperties
.selection().observe(btnDeleteChildren
);
77 IObservableValue deleteChildrenConfiguratorObserveValue
= PojoProperties
.value("deleteChildren").observe(configurator
);
78 bindingContext
.bindValue(observeSelectionBtnDeleteChildrenObserveWidget
, deleteChildrenConfiguratorObserveValue
, null, null);
80 IObservableValue observeSelectionBtnDeleteFromTypeDesignationObserveWidget
= WidgetProperties
.selection().observe(btnDeleteFromTypeDesignation
);
81 IObservableValue deleteFromTypeDesignationConfiguratorObserveValue
= PojoProperties
.value("deleteFromTypeDesignation").observe(configurator
);
82 bindingContext
.bindValue(observeSelectionBtnDeleteFromTypeDesignationObserveWidget
, deleteFromTypeDesignationConfiguratorObserveValue
, null, null);
84 IObservableValue observeSelectionBtnDeleteIndividualsassociationsfactualObserveWidget
= WidgetProperties
.selection().observe(btnDeleteIndividualsassociationsfactual
);
85 IObservableValue deleteFromIndividualsAssociationConfiguratorObserveValue
= PojoProperties
.value("deleteFromIndividualsAssociation").observe(configurator
);
86 bindingContext
.bindValue(observeSelectionBtnDeleteIndividualsassociationsfactualObserveWidget
, deleteFromIndividualsAssociationConfiguratorObserveValue
, null, null);
88 IObservableValue observeSelectionBtnDeleteSpecimenDescriptionObserveWidget
= WidgetProperties
.selection().observe(btnDeleteSpecimenDescription
);
89 IObservableValue deleteFromDescriptionConfiguratorObserveValue
= PojoProperties
.value("deleteFromDescription").observe(configurator
);
90 bindingContext
.bindValue(observeSelectionBtnDeleteSpecimenDescriptionObserveWidget
, deleteFromDescriptionConfiguratorObserveValue
, null, null);
92 return bindingContext
;