1
|
// $Id$
|
2
|
/**
|
3
|
* Copyright (C) 2009 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
|
package eu.etaxonomy.taxeditor.ui.section.common;
|
11
|
|
12
|
import eu.etaxonomy.cdm.model.common.ReferencedEntityBase;
|
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
|
* @author n.hoffmann
|
22
|
* @date Dec 1, 2011
|
23
|
*
|
24
|
*/
|
25
|
public class ReferenceEntityDetailElement extends AbstractCdmDetailElement<ReferencedEntityBase>{
|
26
|
|
27
|
private EntitySelectionElement<Reference> selection_reference;
|
28
|
private TextWithLabelElement text_referenceDetail;
|
29
|
|
30
|
public ReferenceEntityDetailElement(CdmFormFactory formFactory,
|
31
|
ICdmFormElement formElement) {
|
32
|
super(formFactory, formElement);
|
33
|
}
|
34
|
|
35
|
@Override
|
36
|
protected void createControls(ICdmFormElement formElement,
|
37
|
ReferencedEntityBase entity, int style) {
|
38
|
selection_reference = formFactory
|
39
|
.createSelectionElement(Reference.class,
|
40
|
getConversationHolder(), formElement, "Reference",
|
41
|
entity.getCitation(),
|
42
|
EntitySelectionElement.ALL, style);
|
43
|
text_referenceDetail = formFactory.createTextWithLabelElement(
|
44
|
formElement, "Reference Detail",
|
45
|
entity.getCitationMicroReference(), style);
|
46
|
}
|
47
|
|
48
|
@Override
|
49
|
public void handleEvent(Object eventSource) {
|
50
|
if (eventSource == selection_reference) {
|
51
|
getEntity().setCitation(selection_reference.getSelection());
|
52
|
} else if (eventSource == text_referenceDetail) {
|
53
|
getEntity().setCitationMicroReference(
|
54
|
text_referenceDetail.getText());
|
55
|
}
|
56
|
}
|
57
|
|
58
|
}
|