1
|
// $Id$
|
2
|
/**
|
3
|
* Copyright (C) 2014 EDIT
|
4
|
* European Distributed Institute of Taxonomy
|
5
|
* http://www.e-taxonomy.eu
|
6
|
*
|
7
|
* The contents of this file are subject to the Mozilla Public License Version 1.1
|
8
|
* See LICENSE.TXT at the top of this package for the full license terms.
|
9
|
*/
|
10
|
package eu.etaxonomy.taxeditor.view.specimenSearch;
|
11
|
|
12
|
import org.eclipse.swt.SWT;
|
13
|
import org.eclipse.swt.widgets.Composite;
|
14
|
import org.eclipse.swt.widgets.Event;
|
15
|
import org.eclipse.swt.widgets.Listener;
|
16
|
|
17
|
/**
|
18
|
* Controller class for handling {@link SpecimenProviderSelectionComposite}
|
19
|
* @author pplitzner
|
20
|
* @date 22.05.2014
|
21
|
*
|
22
|
*/
|
23
|
public class SpecimenProviderSelectionController implements Listener{
|
24
|
|
25
|
private final SpecimenProviderSelectionComposite composite;
|
26
|
|
27
|
/**
|
28
|
* Constructs a new controller which will itself construct the composite
|
29
|
* @param parent the parent {@link Composite} for the one handles by this controller
|
30
|
*/
|
31
|
public SpecimenProviderSelectionController(Composite parent) {
|
32
|
composite = new SpecimenProviderSelectionComposite(parent, SWT.NONE);
|
33
|
composite.getBtnBioCaseProvider().addListener(SWT.Selection, this);
|
34
|
composite.getBtnGbif().addListener(SWT.Selection, this);
|
35
|
composite.getBtnGbif().setSelection(true);
|
36
|
composite.getTxtAccessPoint().setEnabled(false);
|
37
|
composite.getLblAccessPointUrl().setEnabled(false);
|
38
|
}
|
39
|
|
40
|
/* (non-Javadoc)
|
41
|
* @see org.eclipse.swt.widgets.Listener#handleEvent(org.eclipse.swt.widgets.Event)
|
42
|
*/
|
43
|
@Override
|
44
|
public void handleEvent(Event event) {
|
45
|
if(event.widget==composite.getBtnBioCaseProvider()){
|
46
|
composite.getTxtAccessPoint().setEnabled(true);
|
47
|
composite.getLblAccessPointUrl().setEnabled(true);
|
48
|
}
|
49
|
else if(event.widget==composite.getBtnGbif()){
|
50
|
composite.getLblAccessPointUrl().setEnabled(false);
|
51
|
composite.getTxtAccessPoint().setEnabled(false);
|
52
|
}
|
53
|
}
|
54
|
|
55
|
/**
|
56
|
* @return the composite
|
57
|
*/
|
58
|
public SpecimenProviderSelectionComposite getComposite() {
|
59
|
return composite;
|
60
|
}
|
61
|
|
62
|
}
|