Project

General

Profile

Download (3.11 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.specimenSearch;
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.taxeditor.preference.IPreferenceKeys;
24
import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
25

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

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

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

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

    
65
        btnBioCaseProvider = new Button(this, SWT.RADIO);
66
        toolkit.adapt(btnBioCaseProvider, true, true);
67
        btnBioCaseProvider.setText("BioCASE Provider");
68
        txtAccessPoint = new Combo(this, SWT.BORDER);
69
        String items[] = PreferencesUtil.getPreferenceStore().getString(IPreferenceKeys.BIOCASE_PROVIDER_LIST).split(";");
70
        txtAccessPoint.setItems(items);
71
        txtAccessPoint.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB, TableWrapData.TOP, 1, 1));
72
        toolkit.adapt(txtAccessPoint, true, true);
73

    
74
        lblAccessPointUrl = new Label(this, SWT.NONE);
75
        lblAccessPointUrl.setLayoutData(new TableWrapData(TableWrapData.LEFT, TableWrapData.MIDDLE, 1, 1));
76
        toolkit.adapt(lblAccessPointUrl, true, true);
77
        lblAccessPointUrl.setText("Access Point URL");
78

    
79
    }
80

    
81
    public Button getBtnGbif() {
82
        return btnGbif;
83
    }
84
    public Button getBtnBioCaseProvider() {
85
        return btnBioCaseProvider;
86
    }
87
    public Combo getTxtAccessPoint() {
88
        return txtAccessPoint;
89
    }
90
    public Label getLblAccessPointUrl() {
91
        return lblAccessPointUrl;
92
    }
93
}
(1-1/4)