Project

General

Profile

Download (1.83 KB) Statistics
| Branch: | Tag: | Revision:
1
/**
2
* Copyright (C) 2018 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.preference.wizard;
10

    
11
import org.eclipse.swt.SWT;
12
import org.eclipse.swt.events.SelectionAdapter;
13
import org.eclipse.swt.events.SelectionEvent;
14
import org.eclipse.swt.widgets.Button;
15
import org.eclipse.swt.widgets.Composite;
16

    
17
import eu.etaxonomy.cdm.model.common.TermType;
18
import eu.etaxonomy.cdm.model.metadata.CdmPreference;
19
import eu.etaxonomy.taxeditor.session.ICdmEntitySessionEnabled;
20

    
21
/**
22
 * @author k.luther
23
 * @since 22.11.2018
24
 *
25
 */
26
public abstract class AbstractAdminTermSelectionWizardPage extends AbstractTermSelectionWizardPage
27
        implements ICdmEntitySessionEnabled {
28

    
29
    /**
30
     * @param pageName
31
     * @param type
32
     */
33
    protected AbstractAdminTermSelectionWizardPage(String pageName, TermType type, CdmPreference pref) {
34
        super(pageName, type);
35
        this.pref = pref;
36

    
37
        this.allowOverride = this.pref.isAllowOverride();
38
    }
39

    
40
    CdmPreference pref;
41
    boolean allowOverride;
42

    
43
    /**
44
     * {@inheritDoc}
45
     */
46

    
47
    protected void createAllowOverrideButton(Composite parent) {
48
        final Button activateCheckButton = new Button(parent, SWT.CHECK);
49
        activateCheckButton.setText("Allow Override");
50
        activateCheckButton.setSelection(pref.isAllowOverride());
51

    
52
        activateCheckButton.addSelectionListener(new SelectionAdapter(){
53
                @Override
54
                public void widgetSelected(SelectionEvent e) {
55
                    pref.setAllowOverride(activateCheckButton.getSelection());
56
                }
57
            });
58
    }
59

    
60
    public CdmPreference getPreference(){
61
        return pref;
62
    }
63

    
64

    
65

    
66
}
(1-1/14)