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 btnDeleteMolecularData
;
41 private final Button btnDeleteIndividualsassociationsfactual
;
42 private final Button btnDeleteSpecimenDescription
;
45 * Create the composite.
49 public DeleteSpecimenConfiguratorComposite(SpecimenDeleteConfigurator configurator
, Composite parent
, int style
) {
51 this.configurator
= configurator
;
52 addDisposeListener(new DisposeListener() {
54 public void widgetDisposed(DisposeEvent e
) {
58 toolkit
.paintBordersFor(this);
59 setLayout(new RowLayout(SWT
.VERTICAL
));
61 btnDeleteChildren
= new Button(this, SWT
.CHECK
);
62 btnDeleteChildren
.setText("Delete Children");
64 btnDeleteFromTypeDesignation
= new Button(this, SWT
.CHECK
);
65 btnDeleteFromTypeDesignation
.setText("Delete from type designation");
67 btnDeleteMolecularData
= new Button(this, SWT
.CHECK
);
68 btnDeleteMolecularData
.setText("Delete molecular data");
70 btnDeleteIndividualsassociationsfactual
= new Button(this, SWT
.CHECK
);
71 btnDeleteIndividualsassociationsfactual
.setText("Delete from factual data");
73 btnDeleteSpecimenDescription
= new Button(this, SWT
.CHECK
);
74 btnDeleteSpecimenDescription
.setText("Delete specimen description");
75 m_bindingContext
= initDataBindings();
78 protected DataBindingContext
initDataBindings() {
79 DataBindingContext bindingContext
= new DataBindingContext();
81 IObservableValue observeSelectionBtnDeleteChildrenObserveWidget
= WidgetProperties
.selection().observe(btnDeleteChildren
);
82 IObservableValue deleteChildrenConfiguratorObserveValue
= PojoProperties
.value("deleteChildren").observe(configurator
);
83 bindingContext
.bindValue(observeSelectionBtnDeleteChildrenObserveWidget
, deleteChildrenConfiguratorObserveValue
, null, null);
85 IObservableValue observeSelectionBtnDeleteFromTypeDesignationObserveWidget
= WidgetProperties
.selection().observe(btnDeleteFromTypeDesignation
);
86 IObservableValue deleteFromTypeDesignationConfiguratorObserveValue
= PojoProperties
.value("deleteFromTypeDesignation").observe(configurator
);
87 bindingContext
.bindValue(observeSelectionBtnDeleteFromTypeDesignationObserveWidget
, deleteFromTypeDesignationConfiguratorObserveValue
, null, null);
89 IObservableValue observeSelectionBtnDeleteMolecularDataObserveWidget
= WidgetProperties
.selection().observe(btnDeleteMolecularData
);
90 IObservableValue deleteMolecularDataConfiguratorObserveValue
= PojoProperties
.value("deleteMolecularData").observe(configurator
);
91 bindingContext
.bindValue(observeSelectionBtnDeleteMolecularDataObserveWidget
, deleteMolecularDataConfiguratorObserveValue
, null, null);
93 IObservableValue observeSelectionBtnDeleteIndividualsassociationsfactualObserveWidget
= WidgetProperties
.selection().observe(btnDeleteIndividualsassociationsfactual
);
94 IObservableValue deleteFromIndividualsAssociationConfiguratorObserveValue
= PojoProperties
.value("deleteFromIndividualsAssociation").observe(configurator
);
95 bindingContext
.bindValue(observeSelectionBtnDeleteIndividualsassociationsfactualObserveWidget
, deleteFromIndividualsAssociationConfiguratorObserveValue
, null, null);
97 IObservableValue observeSelectionBtnDeleteSpecimenDescriptionObserveWidget
= WidgetProperties
.selection().observe(btnDeleteSpecimenDescription
);
98 IObservableValue deleteFromDescriptionConfiguratorObserveValue
= PojoProperties
.value("deleteFromDescription").observe(configurator
);
99 bindingContext
.bindValue(observeSelectionBtnDeleteSpecimenDescriptionObserveWidget
, deleteFromDescriptionConfiguratorObserveValue
, null, null);
101 return bindingContext
;