3 * Copyright (C) 2015 EDIT
4 * European Distributed Institute of Taxonomy
5 * http://www.e-taxonomy.eu
7 * The contents of this file are subject to the Mozilla Public License Version 1.1
8 * See LICENSE.TXT at the top of this package for the full license terms.
10 package eu
.etaxonomy
.taxeditor
.ui
.dialog
.deleteConfigurator
;
12 import org
.eclipse
.core
.databinding
.DataBindingContext
;
13 import org
.eclipse
.core
.databinding
.beans
.PojoProperties
;
14 import org
.eclipse
.core
.databinding
.observable
.value
.IObservableValue
;
15 import org
.eclipse
.jface
.databinding
.swt
.WidgetProperties
;
16 import org
.eclipse
.swt
.SWT
;
17 import org
.eclipse
.swt
.events
.DisposeEvent
;
18 import org
.eclipse
.swt
.events
.DisposeListener
;
19 import org
.eclipse
.swt
.layout
.RowLayout
;
20 import org
.eclipse
.swt
.widgets
.Button
;
21 import org
.eclipse
.swt
.widgets
.Composite
;
22 import org
.eclipse
.swt
.widgets
.Display
;
23 import org
.eclipse
.ui
.forms
.widgets
.FormToolkit
;
25 import eu
.etaxonomy
.cdm
.api
.service
.config
.SpecimenDeleteConfigurator
;
32 public class DeleteSpecimenConfiguratorComposite
extends Composite
{
33 private final DataBindingContext m_bindingContext
;
35 private final FormToolkit toolkit
= new FormToolkit(Display
.getCurrent());
37 private final SpecimenDeleteConfigurator configurator
;
38 private final Button btnDeleteChildren
;
39 private final Button btnDeleteFromTypeDesignation
;
40 private final Button btnDeleteIndividualsassociationsfactual
;
41 private final Button btnDeleteSpecimenDescription
;
44 * Create the composite.
48 public DeleteSpecimenConfiguratorComposite(SpecimenDeleteConfigurator configurator
, Composite parent
, int style
) {
50 this.configurator
= configurator
;
51 addDisposeListener(new DisposeListener() {
53 public void widgetDisposed(DisposeEvent e
) {
57 toolkit
.paintBordersFor(this);
58 setLayout(new RowLayout(SWT
.VERTICAL
));
60 btnDeleteChildren
= new Button(this, SWT
.CHECK
);
61 btnDeleteChildren
.setText("Delete Children");
63 btnDeleteFromTypeDesignation
= new Button(this, SWT
.CHECK
);
64 btnDeleteFromTypeDesignation
.setText("Delete from type designations");
66 btnDeleteIndividualsassociationsfactual
= new Button(this, SWT
.CHECK
);
67 btnDeleteIndividualsassociationsfactual
.setText("Delete from factual data");
69 btnDeleteSpecimenDescription
= new Button(this, SWT
.CHECK
);
70 btnDeleteSpecimenDescription
.setText("Delete from \"Described specimen\" in taxon descriptions");
71 m_bindingContext
= initDataBindings();
74 protected DataBindingContext
initDataBindings() {
75 DataBindingContext bindingContext
= new DataBindingContext();
77 IObservableValue observeSelectionBtnDeleteChildrenObserveWidget
= WidgetProperties
.selection().observe(btnDeleteChildren
);
78 IObservableValue deleteChildrenConfiguratorObserveValue
= PojoProperties
.value("deleteChildren").observe(configurator
);
79 bindingContext
.bindValue(observeSelectionBtnDeleteChildrenObserveWidget
, deleteChildrenConfiguratorObserveValue
, null, null);
81 IObservableValue observeSelectionBtnDeleteFromTypeDesignationObserveWidget
= WidgetProperties
.selection().observe(btnDeleteFromTypeDesignation
);
82 IObservableValue deleteFromTypeDesignationConfiguratorObserveValue
= PojoProperties
.value("deleteFromTypeDesignation").observe(configurator
);
83 bindingContext
.bindValue(observeSelectionBtnDeleteFromTypeDesignationObserveWidget
, deleteFromTypeDesignationConfiguratorObserveValue
, null, null);
85 IObservableValue observeSelectionBtnDeleteIndividualsassociationsfactualObserveWidget
= WidgetProperties
.selection().observe(btnDeleteIndividualsassociationsfactual
);
86 IObservableValue deleteFromIndividualsAssociationConfiguratorObserveValue
= PojoProperties
.value("deleteFromIndividualsAssociation").observe(configurator
);
87 bindingContext
.bindValue(observeSelectionBtnDeleteIndividualsassociationsfactualObserveWidget
, deleteFromIndividualsAssociationConfiguratorObserveValue
, null, null);
89 IObservableValue observeSelectionBtnDeleteSpecimenDescriptionObserveWidget
= WidgetProperties
.selection().observe(btnDeleteSpecimenDescription
);
90 IObservableValue deleteFromDescriptionConfiguratorObserveValue
= PojoProperties
.value("deleteFromDescription").observe(configurator
);
91 bindingContext
.bindValue(observeSelectionBtnDeleteSpecimenDescriptionObserveWidget
, deleteFromDescriptionConfiguratorObserveValue
, null, null);
93 return bindingContext
;