Project

General

Profile

Download (2.81 KB) Statistics
| Branch: | Tag: | Revision:
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.occurrence;
12

    
13
import org.eclipse.swt.events.SelectionListener;
14

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

    
22
/**
23
 * <p>
24
 * CollectingAreasDetailElement class.
25
 * </p>
26
 * 
27
 * @author n.hoffmann
28
 * @created Oct 14, 2010
29
 * @version 1.0
30
 */
31
public class NamedAreaDetailElement extends
32
		AbstractEntityCollectionElement<NamedArea> {
33

    
34
	private EntitySelectionElement<NamedArea> selection_namedArea;
35

    
36
	/**
37
	 * <p>
38
	 * Constructor for CollectingAreasDetailElement.
39
	 * </p>
40
	 * 
41
	 * @param formFactory
42
	 *            a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory}
43
	 *            object.
44
	 * @param section
45
	 *            a {@link eu.etaxonomy.taxeditor.ui.element.AbstractFormSection}
46
	 *            object.
47
	 * @param entity
48
	 *            a {@link eu.etaxonomy.cdm.model.location.NamedArea} object.
49
	 * @param removeListener
50
	 *            a {@link org.eclipse.swt.events.SelectionListener} object.
51
	 * @param style
52
	 *            a int.
53
	 */
54
	public NamedAreaDetailElement(CdmFormFactory formFactory,
55
			AbstractFormSection section, NamedArea entity,
56
			SelectionListener removeListener, int style) {
57
		super(formFactory, section, entity, removeListener, null, style);
58
	}
59

    
60
	/*
61
	 * (non-Javadoc)
62
	 * 
63
	 * @see
64
	 * eu.etaxonomy.taxeditor.section.AbstractEntityCollectionElement#setEntity
65
	 * (java.lang.Object)
66
	 */
67
	/** {@inheritDoc} */
68
	@Override
69
	public void setEntity(NamedArea entity) {
70
		selection_namedArea.setEntity(entity);
71
	}
72

    
73
	/*
74
	 * (non-Javadoc)
75
	 * 
76
	 * @see
77
	 * eu.etaxonomy.taxeditor.section.AbstractEntityCollectionElement#createControls
78
	 * (eu.etaxonomy.taxeditor.forms.ICdmFormElement, int)
79
	 */
80
	/** {@inheritDoc} */
81
	@Override
82
	public void createControls(ICdmFormElement formElement, int style) {
83
		selection_namedArea = formFactory.createSelectionElement(NamedArea.class, getConversationHolder(),
84
				formElement, "Area",
85
				null, EntitySelectionElement.NOTHING, style);
86
	}
87

    
88
	/*
89
	 * (non-Javadoc)
90
	 * 
91
	 * @see
92
	 * eu.etaxonomy.taxeditor.section.AbstractEntityCollectionElement#handleEvent
93
	 * (java.lang.Object)
94
	 */
95
	/** {@inheritDoc} */
96
	@Override
97
	public void handleEvent(Object eventSource) {
98
		if (eventSource == selection_namedArea) {
99
			setEntity(selection_namedArea.getSelection());
100
		}
101
	}
102

    
103
}
(26-26/29)