1
|
// $Id$
|
2
|
/**
|
3
|
* Copyright (C) 2013 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
|
package eu.etaxonomy.taxeditor.ui.campanula.basicFields;
|
11
|
|
12
|
import org.eclipse.swt.SWT;
|
13
|
import org.eclipse.swt.events.SelectionListener;
|
14
|
|
15
|
import eu.etaxonomy.cdm.model.location.NamedArea;
|
16
|
import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
|
17
|
import eu.etaxonomy.taxeditor.ui.element.AbstractFormSection;
|
18
|
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
|
19
|
import eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionElement;
|
20
|
import eu.etaxonomy.taxeditor.ui.selection.EntitySelectionElement;
|
21
|
|
22
|
/**
|
23
|
* @author pplitzner
|
24
|
* @date 15.08.2013
|
25
|
*
|
26
|
*/
|
27
|
public class NamedAreaFieldController extends AbstractEntityCollectionElement<NamedArea> {
|
28
|
|
29
|
private EntitySelectionFieldController<NamedArea> selection_namedArea;
|
30
|
|
31
|
/**
|
32
|
* <p>
|
33
|
* Constructor for CollectingAreasDetailElement.
|
34
|
* </p>
|
35
|
*
|
36
|
* @param formFactory
|
37
|
* a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory}
|
38
|
* object.
|
39
|
* @param section
|
40
|
* a
|
41
|
* {@link eu.etaxonomy.taxeditor.ui.element.AbstractFormSection}
|
42
|
* object.
|
43
|
* @param entity
|
44
|
* a {@link eu.etaxonomy.cdm.model.location.NamedArea} object.
|
45
|
* @param removeListener
|
46
|
* a {@link org.eclipse.swt.events.SelectionListener} object.
|
47
|
* @param style
|
48
|
* a int.
|
49
|
*/
|
50
|
public NamedAreaFieldController(CdmFormFactory formFactory, AbstractFormSection section, NamedArea entity, SelectionListener removeListener, int style) {
|
51
|
super(formFactory, section, entity, removeListener, null, style);
|
52
|
}
|
53
|
|
54
|
/*
|
55
|
* (non-Javadoc)
|
56
|
*
|
57
|
* @see
|
58
|
* eu.etaxonomy.taxeditor.section.AbstractEntityCollectionElement#setEntity
|
59
|
* (java.lang.Object)
|
60
|
*/
|
61
|
/** {@inheritDoc} */
|
62
|
@Override
|
63
|
public void setEntity(NamedArea entity) {
|
64
|
selection_namedArea.setEntity(entity);
|
65
|
}
|
66
|
|
67
|
/*
|
68
|
* (non-Javadoc)
|
69
|
*
|
70
|
* @see
|
71
|
* eu.etaxonomy.taxeditor.section.AbstractEntityCollectionElement#createControls
|
72
|
* (eu.etaxonomy.taxeditor.forms.ICdmFormElement, int)
|
73
|
*/
|
74
|
/** {@inheritDoc} */
|
75
|
@Override
|
76
|
public void createControls(ICdmFormElement formElement, int style) {
|
77
|
selection_namedArea = new EntitySelectionFieldController<NamedArea>(new EntitySelectionField(formElement.getLayoutComposite(), SWT.NONE), getFormFactory(), getConversationHolder(), formElement, NamedArea.class, "", null, EntitySelectionElement.NOTHING);
|
78
|
}
|
79
|
|
80
|
/*
|
81
|
* (non-Javadoc)
|
82
|
*
|
83
|
* @see
|
84
|
* eu.etaxonomy.taxeditor.section.AbstractEntityCollectionElement#handleEvent
|
85
|
* (java.lang.Object)
|
86
|
*/
|
87
|
/** {@inheritDoc} */
|
88
|
@Override
|
89
|
public void handleEvent(Object eventSource) {
|
90
|
if (eventSource == selection_namedArea) {
|
91
|
setEntity(selection_namedArea.getSelection());
|
92
|
}
|
93
|
}
|
94
|
}
|