Project

General

Profile

Download (2.45 KB) Statistics
| Branch: | Tag: | Revision:
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
	private boolean namedAreaEditable = true;
33

    
34

    
35
	/**
36
	 * <p>Constructor for DistributionDetailElement.</p>
37
	 *
38
	 * @param formFactory a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory} object.
39
	 * @param formElement a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement} object.
40
	 * @param entity a {@link eu.etaxonomy.cdm.model.description.Distribution} object.
41
	 * @param style a int.
42
	 */
43
	public DistributionDetailElement(CdmFormFactory formFactory,
44
			ICdmFormElement formElement, Distribution entity, int style) {
45
		super(formFactory, formElement, entity, style);
46

    
47
	}
48

    
49
	/** {@inheritDoc} */
50
	@Override
51
	protected void createControls(ICdmFormElement formElement,
52
			Distribution entity, int style) {
53
		selection_namedArea = formFactory.createSelectionElement(NamedArea.class, //getConversationHolder(),
54
				formElement, "Area",
55
				entity.getArea(), EntitySelectionElement.NOTHING, style);
56
		ICdmFormElement parent = this.getParentElement();
57

    
58
        combo_presenceAbsence = formFactory.createTermComboElement(PresenceAbsenceTerm.class, this, "Distribution Status", entity.getStatus(), style);
59

    
60
	}
61

    
62
	/** {@inheritDoc} */
63
	@Override
64
	public void handleEvent(Object eventSource) {
65
		if(eventSource == selection_namedArea){
66
			getEntity().setArea(selection_namedArea.getEntity());
67
		}else if(eventSource == combo_presenceAbsence){
68
			getEntity().setStatus(combo_presenceAbsence.getSelection());
69
		}
70
	}
71

    
72

    
73
}
(4-4/8)