refactoring of package names for consistency
[taxeditor.git] / eu.etaxonomy.taxeditor.store / src / main / java / eu / etaxonomy / taxeditor / ui / section / reference / NomenclaturalReferenceDetailElement.java
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.ui.element.CdmFormFactory;
17 import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
18 import eu.etaxonomy.taxeditor.ui.element.TextWithLabelElement;
19 import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory.SelectionType;
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 TextWithLabelElement text_referenceDetail;
39
40 /**
41 * <p>
42 * Constructor for NomenclaturalReferenceDetailElement.
43 * </p>
44 *
45 * @param cdmFormFactory
46 * a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory}
47 * object.
48 * @param formElement
49 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
50 * object.
51 * @param style
52 * a int.
53 */
54 public NomenclaturalReferenceDetailElement(CdmFormFactory 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 }