Project

General

Profile

Download (2.51 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.reference;
11

    
12
import eu.etaxonomy.cdm.model.name.TaxonNameBase;
13
import eu.etaxonomy.cdm.model.reference.Reference;
14
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
15
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
16
import eu.etaxonomy.taxeditor.ui.element.TextWithLabelElement;
17
import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;
18
import eu.etaxonomy.taxeditor.ui.selection.EntitySelectionElement;
19

    
20
/**
21
 * <p>
22
 * NomenclaturalReferenceDetailElement class.
23
 * </p>
24
 *
25
 * @author n.hoffmann
26
 * @created Mar 12, 2010
27
 * @version 1.0
28
 */
29
public class NomenclaturalReferenceDetailElement extends
30
		AbstractCdmDetailElement<TaxonNameBase> {
31

    
32
	private EntitySelectionElement<Reference> selection_nomenclaturalReference;
33
	private TextWithLabelElement text_referenceDetail;
34

    
35
	/**
36
	 * <p>
37
	 * Constructor for NomenclaturalReferenceDetailElement.
38
	 * </p>
39
	 *
40
	 * @param cdmFormFactory
41
	 *            a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory}
42
	 *            object.
43
	 * @param formElement
44
	 *            a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
45
	 *            object.
46
	 * @param style
47
	 *            a int.
48
	 */
49
	public NomenclaturalReferenceDetailElement(CdmFormFactory cdmFormFactory,
50
			ICdmFormElement formElement, int style) {
51
		super(cdmFormFactory, formElement);
52
	}
53

    
54
	/** {@inheritDoc} */
55
	@Override
56
	protected void createControls(ICdmFormElement formElement,
57
			TaxonNameBase entity, int style) {
58
		selection_nomenclaturalReference = formFactory
59
				.createSelectionElementWithAbbreviatedTitle(Reference.class,
60
						getConversationHolder(), formElement, "Reference",
61
						(Reference) entity.getNomenclaturalReference(),
62
						EntitySelectionElement.ALL, style);
63
		text_referenceDetail = formFactory.createTextWithLabelElement(
64
				formElement, "Reference Detail",
65
				entity.getNomenclaturalMicroReference(), style);
66
	}
67

    
68
	/** {@inheritDoc} */
69
	@Override
70
	public void handleEvent(Object eventSource) {
71
		if (eventSource == selection_nomenclaturalReference) {
72
			getEntity().setNomenclaturalReference(
73
					selection_nomenclaturalReference.getSelection());
74
		} else if (eventSource == text_referenceDetail) {
75
			getEntity().setNomenclaturalMicroReference(
76
					text_referenceDetail.getText());
77
		}
78
	}
79
}
(1-1/5)