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.occurrence;
|
11
|
|
12
|
import org.eclipse.swt.events.SelectionListener;
|
13
|
|
14
|
import eu.etaxonomy.cdm.model.agent.AgentBase;
|
15
|
import eu.etaxonomy.cdm.model.common.EventBase;
|
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.element.TextWithLabelElement;
|
20
|
import eu.etaxonomy.taxeditor.ui.element.TimePeriodElement;
|
21
|
import eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionElement;
|
22
|
import eu.etaxonomy.taxeditor.ui.selection.EntitySelectionElement;
|
23
|
|
24
|
/**
|
25
|
* <p>
|
26
|
* Abstract AbstractEventDetailElement class.
|
27
|
* </p>
|
28
|
*
|
29
|
* @author n.hoffmann
|
30
|
* @created Oct 14, 2010
|
31
|
*/
|
32
|
public abstract class AbstractEventDetailElement<T extends EventBase> extends
|
33
|
AbstractEntityCollectionElement<T> {
|
34
|
|
35
|
protected EntitySelectionElement<AgentBase> selection_agent;
|
36
|
protected TextWithLabelElement text_description;
|
37
|
protected TimePeriodElement element_timePeriod;
|
38
|
|
39
|
/**
|
40
|
* <p>
|
41
|
* Constructor for AbstractEventDetailElement.
|
42
|
* </p>
|
43
|
*
|
44
|
* @param formFactory
|
45
|
* a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory}
|
46
|
* object.
|
47
|
* @param section
|
48
|
* a {@link eu.etaxonomy.taxeditor.ui.element.AbstractFormSection}
|
49
|
* object.
|
50
|
* @param entity
|
51
|
* a T object.
|
52
|
* @param removeListener
|
53
|
* a {@link org.eclipse.swt.events.SelectionListener} object.
|
54
|
* @param style
|
55
|
* a int.
|
56
|
* @param <T>
|
57
|
* a T object.
|
58
|
*/
|
59
|
public AbstractEventDetailElement(CdmFormFactory formFactory,
|
60
|
AbstractFormSection section, T entity,
|
61
|
SelectionListener removeListener, int style) {
|
62
|
super(formFactory, section, entity, removeListener, null, style);
|
63
|
}
|
64
|
|
65
|
|
66
|
/** {@inheritDoc} */
|
67
|
@Override
|
68
|
public void setEntity(T entity) {
|
69
|
selection_agent.setEntity(entity.getActor());
|
70
|
text_description.setText(entity.getDescription());
|
71
|
element_timePeriod.setEntity(entity.getTimeperiod());
|
72
|
}
|
73
|
|
74
|
|
75
|
/** {@inheritDoc} */
|
76
|
@Override
|
77
|
public void createControls(ICdmFormElement element, int style) {
|
78
|
selection_agent = formFactory
|
79
|
.createSelectionElement(AgentBase.class,//getConversationHolder(),
|
80
|
element, "Actor", null,
|
81
|
EntitySelectionElement.ALL, style);
|
82
|
element_timePeriod = formFactory.createTimePeriodElement(element,
|
83
|
"Time Period", null, style);
|
84
|
text_description = formFactory.createTextWithLabelElement(element,
|
85
|
"Description", null, style);
|
86
|
}
|
87
|
|
88
|
}
|