Project

General

Profile

Revision b5d2e0e3

IDb5d2e0e33e8b1a1c0985a735fb099a6d471c5aa3
Parent f7765feb
Child 56695721

Added by Katja Luther over 3 years ago

minor

View differences:

eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/configurator/deleteConfigurator/ConfiguratorComposite.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.configurator.deleteConfigurator;
10

  
11
import org.eclipse.swt.SWT;
12
import org.eclipse.swt.events.DisposeEvent;
13
import org.eclipse.swt.events.DisposeListener;
14
import org.eclipse.swt.layout.FillLayout;
15
import org.eclipse.swt.widgets.Composite;
16
import org.eclipse.swt.widgets.Display;
17
import org.eclipse.ui.forms.events.ExpansionEvent;
18
import org.eclipse.ui.forms.events.IExpansionListener;
19
import org.eclipse.ui.forms.widgets.FormToolkit;
20
import org.eclipse.ui.forms.widgets.Section;
21

  
22
/**
23
 * @author pplitzner
24
 * @date Feb 16, 2015
25
 *
26
 */
27
public class ConfiguratorComposite extends Composite implements IExpansionListener{
28

  
29
    private final FormToolkit toolkit = new FormToolkit(Display.getCurrent());
30
    private final Section sctnConfigure;
31
    /**
32
     * Create the composite.
33
     * @param parent
34
     * @param style
35
     */
36
    public ConfiguratorComposite(final Composite parent, int style) {
37
        super(parent, SWT.NONE);
38

  
39
        addDisposeListener(new DisposeListener() {
40
            @Override
41
            public void widgetDisposed(DisposeEvent e) {
42
                toolkit.dispose();
43
            }
44
        });
45
        toolkit.paintBordersFor(this);
46
        setLayout(new FillLayout(SWT.HORIZONTAL));
47

  
48
        sctnConfigure = toolkit.createSection(this, Section.CLIENT_INDENT | Section.TWISTIE);
49
        sctnConfigure.addExpansionListener(this);
50
        sctnConfigure.setBackground(getBackground());
51
        toolkit.paintBordersFor(sctnConfigure);
52
        sctnConfigure.setText("Configure");
53

  
54

  
55
    }
56

  
57

  
58
    public void addConfiguratorComposite(Composite configuratorComposite){
59
        toolkit.paintBordersFor(configuratorComposite);
60
        sctnConfigure.setClient(configuratorComposite);
61
    }
62

  
63
    @Override
64
    public void expansionStateChanged(ExpansionEvent e) {
65
        getShell().setSize(getShell().computeSize(SWT.DEFAULT, SWT.DEFAULT));
66
    }
67
    @Override
68
    public void expansionStateChanging(ExpansionEvent e) {
69
    }
70
    public Section getSectionConfigure() {
71
        return sctnConfigure;
72
    }
73
}
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/configurator/deleteConfigurator/DeleteConfiguratorDialog.java
23 23
import eu.etaxonomy.cdm.api.service.config.SynonymDeletionConfigurator;
24 24
import eu.etaxonomy.cdm.api.service.config.TaxonDeletionConfigurator;
25 25
import eu.etaxonomy.cdm.api.service.config.TaxonNodeDeletionConfigurator;
26
import eu.etaxonomy.taxeditor.ui.dialog.configurator.ConfiguratorComposite;
26 27

  
27 28
/**
28 29
 * Abstract subclass of MessageDialog providing the functionality to configure
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/deleteConfigurator/DeleteNodeConfiguratorComposite.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

  
10
package eu.etaxonomy.taxeditor.ui.dialog.deleteConfigurator;
11

  
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.widgets.Button;
18
import org.eclipse.swt.widgets.Composite;
19
import org.eclipse.swt.widgets.Display;
20
import org.eclipse.ui.forms.widgets.FormToolkit;
21
import org.eclipse.swt.events.DisposeEvent;
22
import org.eclipse.swt.events.DisposeListener;
23
import org.eclipse.swt.layout.RowLayout;
24

  
25
import eu.etaxonomy.cdm.api.service.config.TaxonDeletionConfigurator;
26
import eu.etaxonomy.cdm.api.service.config.TaxonNodeDeletionConfigurator;
27
/**
28
 * @author kluther
29
 * @date Jul 13, 2015
30
 *
31
 */
32
public class DeleteNodeConfiguratorComposite extends Composite {
33
	// $Id$
34
	
35
	private final DataBindingContext m_bindingContext;
36

  
37
	private final FormToolkit toolkit = new FormToolkit(Display.getCurrent());
38
	private final TaxonNodeDeletionConfigurator configurator;
39
	private final Button btnDeleteTaxon;
40

  
41

  
42
	    /**
43
	     * Create the composite.
44
	     * @param parent
45
	     * @param style
46
	     */
47
	    public DeleteNodeConfiguratorComposite(TaxonNodeDeletionConfigurator 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
	        setBackground(getBackground());
59

  
60
	        btnDeleteTaxon = new Button(this, SWT.CHECK);
61
	        btnDeleteTaxon.setText("Delete taxon if possible");
62
	     
63
	        m_bindingContext = initDataBindings();
64

  
65
	    }
66

  
67
	    protected DataBindingContext initDataBindings() {
68
	        DataBindingContext bindingContext = new DataBindingContext();
69
	        //
70
	        IObservableValue observeSelectionBtnDeleteTaxonObserveWidget = WidgetProperties.selection().observe(btnDeleteTaxon);
71
	        IObservableValue deleteTaxonIfPossibleConfiguratorObserveValue = PojoProperties.value("deleteTaxon").observe(configurator);
72
	        bindingContext.bindValue(observeSelectionBtnDeleteTaxonObserveWidget, deleteTaxonIfPossibleConfiguratorObserveValue, null, null);
73
	        //
74
	        return bindingContext;
75
	    }
76
	}
77

  
78

  

Also available in: Unified diff

Add picture from clipboard (Maximum size: 40 MB)