Project

General

Profile

Download (2.22 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
package eu.etaxonomy.taxeditor.ui.section.occurrence;
10

    
11
import org.eclipse.swt.events.SelectionListener;
12

    
13
import eu.etaxonomy.cdm.model.location.NamedArea;
14
import eu.etaxonomy.taxeditor.ui.element.AbstractFormSection;
15
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
16
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
17
import eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionElement;
18
import eu.etaxonomy.taxeditor.ui.selection.EntitySelectionElement;
19

    
20
/**
21
 * @author n.hoffmann
22
 * @created Oct 14, 2010
23
 */
24
public class CollectingAreaDetailElement extends
25
		AbstractEntityCollectionElement<NamedArea> {
26

    
27
	private EntitySelectionElement<NamedArea> selection_namedArea;
28

    
29
	/**
30
	 * <p>
31
	 * Constructor for CollectingAreasDetailElement.
32
	 * </p>
33
	 *
34
	 * @param formFactory
35
	 *            a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory}
36
	 *            object.
37
	 * @param section
38
	 *            a {@link eu.etaxonomy.taxeditor.ui.element.AbstractFormSection}
39
	 *            object.
40
	 * @param entity
41
	 *            a {@link eu.etaxonomy.cdm.model.location.NamedArea} object.
42
	 * @param removeListener
43
	 *            a {@link org.eclipse.swt.events.SelectionListener} object.
44
	 * @param style
45
	 *            a int.
46
	 */
47
	public CollectingAreaDetailElement(CdmFormFactory formFactory,
48
			AbstractFormSection section, NamedArea entity,
49
			SelectionListener removeListener, int style) {
50
		super(formFactory, section, entity, removeListener, null, style);
51
	}
52

    
53
	@Override
54
	public void setEntity(NamedArea entity) {
55
		selection_namedArea.setEntity(entity);
56
	}
57

    
58
	@Override
59
	public void createControls(ICdmFormElement formElement, int style) {
60
		selection_namedArea = formFactory.createSelectionElement(NamedArea.class, //getConversationHolder(),
61
				formElement, "Area",
62
				null, EntitySelectionElement.NOTHING, style);
63
	}
64

    
65
	@Override
66
	public void handleEvent(Object eventSource) {
67
		if (eventSource == selection_namedArea) {
68
			setEntity(selection_namedArea.getSelection());
69
		}
70
	}
71
}
(4-4/35)