ref #9266: minor
[taxeditor.git] / eu.etaxonomy.taxeditor.store / src / main / java / eu / etaxonomy / taxeditor / ui / section / common / ReferenceEntityDetailElement.java
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.SingleSourcedEntityBase;
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 public class ReferenceEntityDetailElement extends AbstractCdmDetailElement<SingleSourcedEntityBase>{
24
25 private EntitySelectionElement<Reference> selection_reference;
26 private TextWithLabelElement text_referenceDetail;
27
28 public ReferenceEntityDetailElement(CdmFormFactory formFactory,
29 ICdmFormElement formElement) {
30 super(formFactory, formElement);
31 }
32
33 @Override
34 protected void createControls(ICdmFormElement formElement,
35 SingleSourcedEntityBase entity, int style) {
36 selection_reference = formFactory
37 .createSelectionElement(Reference.class,//getConversationHolder(),
38 formElement, "Reference",
39 entity.getCitation(),
40 EntitySelectionElement.ALL, style);
41 text_referenceDetail = formFactory.createTextWithLabelElement(
42 formElement, "Reference Detail",
43 entity.getCitationMicroReference(), style);
44 }
45
46 @Override
47 public void handleEvent(Object eventSource) {
48 if (eventSource == selection_reference) {
49 getEntity().setCitation(selection_reference.getSelection());
50 } else if (eventSource == text_referenceDetail) {
51 getEntity().setCitationMicroReference(
52 text_referenceDetail.getText());
53 }
54 }
55
56 }