Project

General

Profile

Download (2.11 KB) Statistics
| Branch: | Tag: | Revision:
1
/**
2
 *
3
 */
4
package eu.etaxonomy.taxeditor.ui.section.supplemental;
5

    
6
import org.eclipse.swt.events.SelectionListener;
7

    
8
import eu.etaxonomy.cdm.model.common.IdentifiableSource;
9
import eu.etaxonomy.taxeditor.ui.element.AbstractFormSection;
10
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
11
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
12

    
13
/**
14
 * @author n.hoffmann
15
 * @created Nov 16, 2009
16
 * @version 1.0
17
 */
18
public class IdentifiableSourceElement extends AbstractOriginalSourceElement<IdentifiableSource>{
19

    
20
	public IdentifiableSourceElement(CdmFormFactory cdmFormFactory, AbstractFormSection formElement, IdentifiableSource element,
21
			SelectionListener removeListener, int style) {
22
		super(cdmFormFactory, formElement, element, removeListener, style);
23
	}
24

    
25
	/** {@inheritDoc} */
26
	@Override
27
	public void createControls(ICdmFormElement formElement, int style) {
28
		super.createControls(formElement, style);
29
	}
30

    
31
	/** {@inheritDoc} */
32
	@Override
33
	public void setEntity(IdentifiableSource entity) {
34
		super.setEntity(entity);
35
		text_idInSource.setText(entity.getIdInSource());
36
		text_idNamespace.setText(entity.getIdNamespace());
37

    
38
		selection_reference.setEntity(entity.getCitation());
39
		text_referenceDetail.setText(entity.getCitationMicroReference());
40
		combo_origsourcetype.setSelection(entity.getType());
41
		text_originaleNameString.setText(entity.getOriginalNameString());
42
	}
43

    
44
	/** {@inheritDoc} */
45
	@Override
46
	public void handleEvent(Object eventSource) {
47
		if(eventSource == text_idInSource){
48
			getEntity().setIdInSource(text_idInSource.getText());
49
		}
50
		else if(eventSource == text_idNamespace){
51
			getEntity().setIdNamespace(text_idNamespace.getText());
52
		}
53
		if(eventSource == selection_reference){
54
			getEntity().setCitation(selection_reference.getSelection());
55
		}
56
		else if(eventSource == text_referenceDetail){
57
			getEntity().setCitationMicroReference(text_referenceDetail.getText());
58
		}
59
		else if(eventSource == text_originaleNameString){
60
			getEntity().setOriginalNameString(text_originaleNameString.getText());
61
		} else if(eventSource == combo_origsourcetype){
62
			getEntity().setType(combo_origsourcetype.getSelection());
63
		}
64
	}
65
}
(12-12/19)