Project

General

Profile

Download (3.31 KB) Statistics
| Branch: | Tag: | Revision:
1
/**
2
 * Copyright (C) 2007 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

    
10
package eu.etaxonomy.taxeditor.ui.section.description;
11

    
12
import org.eclipse.swt.SWT;
13
import org.eclipse.swt.events.SelectionListener;
14

    
15
import eu.etaxonomy.cdm.model.description.DescriptionElementSource;
16
import eu.etaxonomy.cdm.model.name.TaxonNameBase;
17
import eu.etaxonomy.taxeditor.ui.element.AbstractFormSection;
18
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
19
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
20
import eu.etaxonomy.taxeditor.ui.element.IEntityElement;
21
import eu.etaxonomy.taxeditor.ui.section.supplemental.AbstractOriginalSourceElement;
22
import eu.etaxonomy.taxeditor.ui.selection.EntitySelectionElement;
23

    
24
/**
25
 *
26
 * @author n.hoffmann
27
 * @created Nov 16, 2009
28
 * @version 1.0
29
 */
30
public class DescriptionElementSourceElement extends
31
		AbstractOriginalSourceElement<DescriptionElementSource> implements
32
		IEntityElement<DescriptionElementSource> {
33

    
34
	private EntitySelectionElement<TaxonNameBase> selection_name;
35

    
36
	public DescriptionElementSourceElement(CdmFormFactory cdmFormFactory,
37
			AbstractFormSection formElement, DescriptionElementSource element,
38
			SelectionListener removeListener, int style) {
39
		super(cdmFormFactory, formElement, element, removeListener, style);
40
		formFactory.createSelectionArbitrator(this);
41
	}
42

    
43
	/** {@inheritDoc} */
44
	@Override
45
	public void createControls(ICdmFormElement formElement, int style) {
46
		super.createControls(formElement, style);
47
		selection_name = formFactory
48
				.createSelectionElement(TaxonNameBase.class,
49
						getConversationHolder(), formElement, "Name in Source",
50
						null, EntitySelectionElement.ALL, SWT.NULL);
51
	}
52

    
53
	/** {@inheritDoc} */
54
	@Override
55
	public void setEntity(DescriptionElementSource entity) {
56
		super.setEntity(entity);
57
		text_idInSource.setText(entity.getIdInSource());
58
		text_idNamespace.setText(entity.getIdNamespace());
59

    
60
		selection_reference.setEntity(entity.getCitation());
61
		text_referenceDetail.setText(entity.getCitationMicroReference());
62
		text_originaleNameString.setText(entity.getOriginalNameString());
63
		selection_name.setEntity(entity.getNameUsedInSource());
64
		combo_origsourcetype.setSelection(entity.getType());
65
	}
66

    
67
	/** {@inheritDoc} */
68
	@Override
69
	public void setSelected(boolean selected) {
70

    
71
	}
72

    
73
	/** {@inheritDoc} */
74
	@Override
75
	public void handleEvent(Object eventSource) {
76
		if (eventSource == text_idInSource) {
77
			getEntity().setIdInSource(text_idInSource.getText());
78
		} else if (eventSource == text_idNamespace) {
79
			getEntity().setIdNamespace(text_idNamespace.getText());
80
		} else if (eventSource == selection_reference) {
81
			getEntity().setCitation(selection_reference.getSelection());
82
		} else if (eventSource == text_referenceDetail) {
83
			getEntity().setCitationMicroReference(
84
					text_referenceDetail.getText());
85
		} else if (eventSource == text_originaleNameString) {
86
			getEntity().setOriginalNameString(
87
					text_originaleNameString.getText());
88
		} else if (eventSource == selection_name) {
89
			getEntity().setNameUsedInSource(selection_name.getSelection());
90
		}
91
		else if(eventSource == combo_origsourcetype){
92
		    getEntity().setType(combo_origsourcetype.getSelection());
93
		}
94

    
95
	}
96

    
97
}
(8-8/25)