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.supplemental;
|
12
|
|
13
|
import org.eclipse.swt.SWT;
|
14
|
import org.eclipse.swt.events.SelectionListener;
|
15
|
|
16
|
import eu.etaxonomy.cdm.model.common.ReferencedEntityBase;
|
17
|
import eu.etaxonomy.cdm.model.reference.Reference;
|
18
|
import eu.etaxonomy.taxeditor.ui.element.AbstractFormSection;
|
19
|
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
|
20
|
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
|
21
|
import eu.etaxonomy.taxeditor.ui.element.TextWithLabelElement;
|
22
|
import eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionElement;
|
23
|
import eu.etaxonomy.taxeditor.ui.selection.EntitySelectionElement;
|
24
|
|
25
|
/**
|
26
|
* @author n.hoffmann
|
27
|
* @created Mar 25, 2010
|
28
|
* @version 1.0
|
29
|
*/
|
30
|
public abstract class AbstractReferencedEntityElement<T extends ReferencedEntityBase>
|
31
|
extends AbstractEntityCollectionElement<T> {
|
32
|
|
33
|
protected EntitySelectionElement<Reference> selection_reference;
|
34
|
protected TextWithLabelElement text_referenceDetail;
|
35
|
|
36
|
public AbstractReferencedEntityElement(CdmFormFactory formFactory,
|
37
|
AbstractFormSection section, T entity,
|
38
|
SelectionListener removeListener, int style) {
|
39
|
super(formFactory, section, entity, removeListener, null, style);
|
40
|
}
|
41
|
|
42
|
/** {@inheritDoc} */
|
43
|
@Override
|
44
|
public void createControls(ICdmFormElement formElement, int style) {
|
45
|
selection_reference = formFactory
|
46
|
.createSelectionElement(Reference.class,
|
47
|
getConversationHolder(), formElement, "Reference",
|
48
|
null, EntitySelectionElement.ALL, style);
|
49
|
text_referenceDetail = formFactory.createTextWithLabelElement(
|
50
|
formElement, "Reference Detail", null, SWT.NULL);
|
51
|
}
|
52
|
|
53
|
@Override
|
54
|
public void setEntity(T entity) {
|
55
|
this.entity = entity;
|
56
|
|
57
|
selection_reference.setEntity(entity.getCitation());
|
58
|
text_referenceDetail.setText(entity.getCitationMicroReference());
|
59
|
}
|
60
|
|
61
|
}
|