ref #6190 removing svn property place holder in first line of code - java files
[taxeditor.git] / eu.etaxonomy.taxeditor.store / src / main / java / eu / etaxonomy / taxeditor / ui / dialog / deleteConfigurator / DeleteSpecimenConfiguratorComposite.java
1 /**
2 * Copyright (C) 2015 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.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.SpecimenDeleteConfigurator;
25
26 /**
27 * @author pplitzner
28 * @date Feb 18, 2015
29 *
30 */
31 public class DeleteSpecimenConfiguratorComposite extends Composite {
32 private final DataBindingContext m_bindingContext;
33
34 private final FormToolkit toolkit = new FormToolkit(Display.getCurrent());
35
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;
41
42 /**
43 * Create the composite.
44 * @param parent
45 * @param style
46 */
47 public DeleteSpecimenConfiguratorComposite(SpecimenDeleteConfigurator configurator, Composite parent, int style) {
48 super(parent, style);
49 this.configurator = configurator;
50 addDisposeListener(new DisposeListener() {
51 @Override
52 public void widgetDisposed(DisposeEvent e) {
53 toolkit.dispose();
54 }
55 });
56 toolkit.paintBordersFor(this);
57 setLayout(new RowLayout(SWT.VERTICAL));
58
59 btnDeleteChildren = new Button(this, SWT.CHECK);
60 btnDeleteChildren.setText("Delete Children");
61
62 btnDeleteFromTypeDesignation = new Button(this, SWT.CHECK);
63 btnDeleteFromTypeDesignation.setText("Delete from type designations");
64
65 btnDeleteIndividualsassociationsfactual = new Button(this, SWT.CHECK);
66 btnDeleteIndividualsassociationsfactual.setText("Delete from factual data");
67
68 btnDeleteSpecimenDescription = new Button(this, SWT.CHECK);
69 btnDeleteSpecimenDescription.setText("Delete from \"Described specimen\" in taxon descriptions");
70 m_bindingContext = initDataBindings();
71
72 }
73 protected DataBindingContext initDataBindings() {
74 DataBindingContext bindingContext = new DataBindingContext();
75 //
76 IObservableValue observeSelectionBtnDeleteChildrenObserveWidget = WidgetProperties.selection().observe(btnDeleteChildren);
77 IObservableValue deleteChildrenConfiguratorObserveValue = PojoProperties.value("deleteChildren").observe(configurator);
78 bindingContext.bindValue(observeSelectionBtnDeleteChildrenObserveWidget, deleteChildrenConfiguratorObserveValue, null, null);
79 //
80 IObservableValue observeSelectionBtnDeleteFromTypeDesignationObserveWidget = WidgetProperties.selection().observe(btnDeleteFromTypeDesignation);
81 IObservableValue deleteFromTypeDesignationConfiguratorObserveValue = PojoProperties.value("deleteFromTypeDesignation").observe(configurator);
82 bindingContext.bindValue(observeSelectionBtnDeleteFromTypeDesignationObserveWidget, deleteFromTypeDesignationConfiguratorObserveValue, null, null);
83 //
84 IObservableValue observeSelectionBtnDeleteIndividualsassociationsfactualObserveWidget = WidgetProperties.selection().observe(btnDeleteIndividualsassociationsfactual);
85 IObservableValue deleteFromIndividualsAssociationConfiguratorObserveValue = PojoProperties.value("deleteFromIndividualsAssociation").observe(configurator);
86 bindingContext.bindValue(observeSelectionBtnDeleteIndividualsassociationsfactualObserveWidget, deleteFromIndividualsAssociationConfiguratorObserveValue, null, null);
87 //
88 IObservableValue observeSelectionBtnDeleteSpecimenDescriptionObserveWidget = WidgetProperties.selection().observe(btnDeleteSpecimenDescription);
89 IObservableValue deleteFromDescriptionConfiguratorObserveValue = PojoProperties.value("deleteFromDescription").observe(configurator);
90 bindingContext.bindValue(observeSelectionBtnDeleteSpecimenDescriptionObserveWidget, deleteFromDescriptionConfiguratorObserveValue, null, null);
91 //
92 return bindingContext;
93 }
94 }