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