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
|
this.entity = entity;
|
56
|
if (selection_namedArea != null){
|
57
|
selection_namedArea.setEntity(entity);
|
58
|
}
|
59
|
}
|
60
|
|
61
|
@Override
|
62
|
public void createControls(ICdmFormElement formElement, int style) {
|
63
|
selection_namedArea = formFactory.createSelectionElement(NamedArea.class,
|
64
|
formElement, "Area",
|
65
|
null, EntitySelectionElement.NOTHING, style);
|
66
|
if (entity != null){
|
67
|
setEntity(entity);
|
68
|
}
|
69
|
}
|
70
|
|
71
|
@Override
|
72
|
public void handleEvent(Object eventSource) {
|
73
|
if (eventSource == selection_namedArea) {
|
74
|
setEntity(selection_namedArea.getSelection());
|
75
|
}
|
76
|
}
|
77
|
}
|