Project

General

Profile

Download (1.89 KB) Statistics
| Branch: | Tag: | Revision:
1
/**
2
* Copyright (C) 2009 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
package eu.etaxonomy.taxeditor.ui.section.common;
10

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

    
19
/**
20
 * @author n.hoffmann
21
 * @date Dec 1, 2011
22
 *
23
 */
24
public class ReferenceEntityDetailElement extends AbstractCdmDetailElement<ReferencedEntityBase>{
25

    
26
	private EntitySelectionElement<Reference> selection_reference;
27
	private TextWithLabelElement text_referenceDetail;
28

    
29
	public ReferenceEntityDetailElement(CdmFormFactory formFactory,
30
			ICdmFormElement formElement) {
31
		super(formFactory, formElement);
32
	}
33

    
34
	@Override
35
	protected void createControls(ICdmFormElement formElement,
36
			ReferencedEntityBase entity, int style) {
37
		selection_reference = formFactory
38
				.createSelectionElement(Reference.class,//getConversationHolder(),
39
						 formElement, "Reference",
40
						entity.getCitation(),
41
						EntitySelectionElement.ALL, style);
42
		text_referenceDetail = formFactory.createTextWithLabelElement(
43
				formElement, "Reference Detail",
44
				entity.getCitationMicroReference(), style);
45
	}
46

    
47
	@Override
48
	public void handleEvent(Object eventSource) {
49
		if (eventSource == selection_reference) {
50
			getEntity().setCitation(selection_reference.getSelection());
51
		} else if (eventSource == text_referenceDetail) {
52
			getEntity().setCitationMicroReference(
53
					text_referenceDetail.getText());
54
		}
55
	}
56

    
57
}
(1-1/2)