Project

General

Profile

Download (2.76 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.reference;
12

    
13
import org.apache.log4j.Logger;
14

    
15
import eu.etaxonomy.cdm.model.name.TaxonNameBase;
16
import eu.etaxonomy.taxeditor.singlesource.ui.forms.CdmFormFactoryFacade;
17
import eu.etaxonomy.taxeditor.singlesource.ui.forms.TextWithLabelElementFacade;
18
import eu.etaxonomy.taxeditor.singlesource.ui.forms.CdmFormFactoryFacade.SelectionType;
19
import eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement;
20
import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;
21
import eu.etaxonomy.taxeditor.ui.selection.ReferenceSelectionElement;
22

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

    
35
	private static final Logger logger = Logger
36
			.getLogger(NomenclaturalReferenceDetailElement.class);
37
	private ReferenceSelectionElement selection_nomenclaturalReference;
38
	private TextWithLabelElementFacade text_referenceDetail;
39

    
40
	/**
41
	 * <p>
42
	 * Constructor for NomenclaturalReferenceDetailElement.
43
	 * </p>
44
	 * 
45
	 * @param cdmFormFactory
46
	 *            a {@link eu.etaxonomy.taxeditor.singlesource.ui.forms.CdmFormFactoryFacade}
47
	 *            object.
48
	 * @param formElement
49
	 *            a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement}
50
	 *            object.
51
	 * @param style
52
	 *            a int.
53
	 */
54
	public NomenclaturalReferenceDetailElement(CdmFormFactoryFacade cdmFormFactory,
55
			ICdmFormElement formElement, int style) {
56
		super(cdmFormFactory, formElement);
57
	}
58

    
59
	/** {@inheritDoc} */
60
	@Override
61
	protected void createControls(ICdmFormElement formElement,
62
			TaxonNameBase entity, int style) {
63
		selection_nomenclaturalReference = (ReferenceSelectionElement) formFactory
64
				.createSelectionElement(SelectionType.REFERENCE,
65
						getConversationHolder(), formElement, "Reference",
66
						entity.getNomenclaturalReference(),
67
						ReferenceSelectionElement.DEFAULT, style);
68
		text_referenceDetail = formFactory.createTextWithLabelElement(
69
				formElement, "Reference Detail",
70
				entity.getNomenclaturalMicroReference(), style);
71
	}
72

    
73
	/** {@inheritDoc} */
74
	@Override
75
	public void handleEvent(Object eventSource) {
76
		if (eventSource == selection_nomenclaturalReference) {
77
			getEntity().setNomenclaturalReference(
78
					selection_nomenclaturalReference.getSelection());
79
		} else if (eventSource == text_referenceDetail) {
80
			getEntity().setNomenclaturalMicroReference(
81
					text_referenceDetail.getText());
82
		}
83
	}
84
}
(1-1/5)