Project

General

Profile

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

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

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

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

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

    
35
	private EntitySelectionElement<TaxonNameBase> selection_name;
36

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

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

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

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

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

    
72
	}
73

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

    
96
	}
97

    
98
}
(8-8/25)