Project

General

Profile

Download (3.28 KB) Statistics
| Branch: | Tag: | Revision:
1
/**
2
* Copyright (C) 2014 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.view.search.specimen;
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.widgets.Button;
15
import org.eclipse.swt.widgets.Combo;
16
import org.eclipse.swt.widgets.Composite;
17
import org.eclipse.swt.widgets.Display;
18
import org.eclipse.swt.widgets.Label;
19
import org.eclipse.ui.forms.widgets.FormToolkit;
20
import org.eclipse.ui.forms.widgets.TableWrapData;
21
import org.eclipse.ui.forms.widgets.TableWrapLayout;
22

    
23
import eu.etaxonomy.cdm.model.metadata.CdmPreference;
24
import eu.etaxonomy.cdm.model.metadata.PreferencePredicate;
25
import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
26

    
27
/**
28
 * @author pplitzner
29
 * @date 22.05.2014
30
 *
31
 */
32
public class SpecimenProviderSelectionComposite extends Composite {
33

    
34
    private final FormToolkit toolkit = new FormToolkit(Display.getCurrent());
35
    private final Combo txtAccessPoint;
36
    private final Button btnGbif;
37
    private final Button btnBioCaseProvider;
38
    private final Label lblAccessPointUrl;
39

    
40
    /**
41
     * Create the composite.
42
     * @param parent
43
     * @param style
44
     */
45
    public SpecimenProviderSelectionComposite(Composite parent, int style) {
46
        super(parent, style);
47
        addDisposeListener(new DisposeListener() {
48
            @Override
49
            public void widgetDisposed(DisposeEvent e) {
50
                toolkit.dispose();
51
            }
52
        });
53
        toolkit.adapt(this);
54
        toolkit.paintBordersFor(this);
55
        {
56
            TableWrapLayout tableWrapLayout = new TableWrapLayout();
57
            tableWrapLayout.numColumns = 2;
58
            setLayout(tableWrapLayout);
59
        }
60

    
61
        btnGbif = new Button(this, SWT.RADIO);
62
        toolkit.adapt(btnGbif, true, true);
63
        btnGbif.setText("GBIF");
64
        new Label(this, SWT.NONE);
65

    
66
        btnBioCaseProvider = new Button(this, SWT.RADIO);
67
        toolkit.adapt(btnBioCaseProvider, true, true);
68
        btnBioCaseProvider.setText("BioCASE Provider");
69
        txtAccessPoint = new Combo(this, SWT.BORDER);
70
        CdmPreference biocaseProvider = PreferencesUtil.getPreferenceFromDB(PreferencePredicate.BioCaseProvider);
71
        if (biocaseProvider != null){
72
            String items[] = biocaseProvider.getValue().split(";");
73
            txtAccessPoint.setItems(items);
74
        }
75

    
76

    
77
        txtAccessPoint.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB, TableWrapData.TOP, 1, 1));
78
        toolkit.adapt(txtAccessPoint, true, true);
79

    
80
        lblAccessPointUrl = new Label(this, SWT.NONE);
81
        lblAccessPointUrl.setLayoutData(new TableWrapData(TableWrapData.LEFT, TableWrapData.MIDDLE, 1, 1));
82
        toolkit.adapt(lblAccessPointUrl, true, true);
83
        lblAccessPointUrl.setText("Access Point URL");
84

    
85
    }
86

    
87
    public Button getBtnGbif() {
88
        return btnGbif;
89
    }
90
    public Button getBtnBioCaseProvider() {
91
        return btnBioCaseProvider;
92
    }
93
    public Combo getTxtAccessPoint() {
94
        return txtAccessPoint;
95
    }
96
    public Label getLblAccessPointUrl() {
97
        return lblAccessPointUrl;
98
    }
99
}
(1-1/4)