Project

General

Profile

Download (2.49 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.TaxonName;
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
 */
28
public class NomenclaturalReferenceDetailElement extends
29
		AbstractCdmDetailElement<TaxonName> {
30

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

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

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

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