ref #6190 removing svn property place holder in first line of code - java files
[taxeditor.git] / eu.etaxonomy.taxeditor.store / src / main / java / eu / etaxonomy / taxeditor / ui / section / description / detail / DistributionDetailElement.java
1 /**
2 * Copyright (C) 2007 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
10 package eu.etaxonomy.taxeditor.ui.section.description.detail;
11
12 import eu.etaxonomy.cdm.model.description.Distribution;
13 import eu.etaxonomy.cdm.model.description.PresenceAbsenceTerm;
14 import eu.etaxonomy.cdm.model.location.NamedArea;
15 import eu.etaxonomy.taxeditor.ui.combo.TermComboElement;
16 import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
17 import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
18 import eu.etaxonomy.taxeditor.ui.selection.EntitySelectionElement;
19
20 /**
21 * <p>DistributionDetailElement class.</p>
22 *
23 * @author n.hoffmann
24 * @created Jun 10, 2010
25 * @version 1.0
26 */
27 public class DistributionDetailElement extends
28 AbstractDetailedDescriptionDetailElement<Distribution> {
29
30 private EntitySelectionElement<NamedArea> selection_namedArea;
31 private TermComboElement<PresenceAbsenceTerm> combo_presenceAbsence;
32
33
34 /**
35 * <p>Constructor for DistributionDetailElement.</p>
36 *
37 * @param formFactory a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory} object.
38 * @param formElement a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement} object.
39 * @param entity a {@link eu.etaxonomy.cdm.model.description.Distribution} object.
40 * @param style a int.
41 */
42 public DistributionDetailElement(CdmFormFactory formFactory,
43 ICdmFormElement formElement, Distribution entity, int style) {
44 super(formFactory, formElement, entity, style);
45 }
46
47 /** {@inheritDoc} */
48 @Override
49 protected void createControls(ICdmFormElement formElement,
50 Distribution entity, int style) {
51 selection_namedArea = formFactory.createSelectionElement(NamedArea.class, getConversationHolder(),
52 formElement, "Area",
53 entity.getArea(), EntitySelectionElement.NOTHING, style);
54 combo_presenceAbsence = formFactory.createTermComboElement(PresenceAbsenceTerm.class, this, "Distribution Status", entity.getStatus(), style);
55
56 }
57
58 /** {@inheritDoc} */
59 @Override
60 public void handleEvent(Object eventSource) {
61 if(eventSource == selection_namedArea){
62 getEntity().setArea(selection_namedArea.getEntity());
63 }else if(eventSource == combo_presenceAbsence){
64 getEntity().setStatus(combo_presenceAbsence.getSelection());
65 }
66 }
67
68
69 }