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.description.detail;
|
12
|
|
13
|
import org.eclipse.swt.SWT;
|
14
|
|
15
|
import eu.etaxonomy.cdm.model.description.TaxonInteraction;
|
16
|
import eu.etaxonomy.taxeditor.singlesource.ui.forms.CdmFormFactoryFacade;
|
17
|
import eu.etaxonomy.taxeditor.singlesource.ui.forms.TextWithLabelElementFacade;
|
18
|
import eu.etaxonomy.taxeditor.singlesource.ui.forms.CdmFormFactoryFacade.SelectionType;
|
19
|
import eu.etaxonomy.taxeditor.store.CdmStore;
|
20
|
import eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement;
|
21
|
import eu.etaxonomy.taxeditor.ui.selection.TaxonSelectionElement;
|
22
|
|
23
|
/**
|
24
|
* <p>
|
25
|
* TaxonInteractionDetailElement class.
|
26
|
* </p>
|
27
|
*
|
28
|
* @author n.hoffmann
|
29
|
* @created Jun 10, 2010
|
30
|
* @version 1.0
|
31
|
*/
|
32
|
public class TaxonInteractionDetailElement extends
|
33
|
AbstractDetailedDescriptionDetailElement<TaxonInteraction> {
|
34
|
|
35
|
private TaxonSelectionElement taxonSelection;
|
36
|
private TextWithLabelElementFacade interactionDescription;
|
37
|
|
38
|
/**
|
39
|
* <p>
|
40
|
* Constructor for TaxonInteractionDetailElement.
|
41
|
* </p>
|
42
|
*
|
43
|
* @param formFactory
|
44
|
* a {@link eu.etaxonomy.taxeditor.singlesource.ui.forms.CdmFormFactoryFacade}
|
45
|
* object.
|
46
|
* @param formElement
|
47
|
* a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement}
|
48
|
* object.
|
49
|
* @param entity
|
50
|
* a {@link eu.etaxonomy.cdm.model.description.TaxonInteraction}
|
51
|
* object.
|
52
|
* @param style
|
53
|
* a int.
|
54
|
*/
|
55
|
public TaxonInteractionDetailElement(CdmFormFactoryFacade formFactory,
|
56
|
ICdmFormElement formElement, TaxonInteraction entity, int style) {
|
57
|
super(formFactory, formElement, entity, style);
|
58
|
}
|
59
|
|
60
|
/** {@inheritDoc} */
|
61
|
@Override
|
62
|
protected void createControls(ICdmFormElement formElement,
|
63
|
TaxonInteraction entity, int style) {
|
64
|
taxonSelection = (TaxonSelectionElement) formFactory
|
65
|
.createSelectionElement(SelectionType.TAXON,
|
66
|
getConversationHolder(), this, null,
|
67
|
entity.getTaxon2(), TaxonSelectionElement.DEFAULT,
|
68
|
SWT.WRAP);
|
69
|
|
70
|
interactionDescription = formFactory.createMultilineTextWithLabel(this,
|
71
|
"Description", 200, SWT.WRAP);
|
72
|
interactionDescription.setText(entity.getDescription(CdmStore
|
73
|
.getDefaultLanguage()));
|
74
|
}
|
75
|
|
76
|
/** {@inheritDoc} */
|
77
|
@Override
|
78
|
public void handleEvent(Object eventSource) {
|
79
|
if (eventSource == taxonSelection) {
|
80
|
getEntity().setTaxon2(taxonSelection.getEntity());
|
81
|
} else if (eventSource == interactionDescription) {
|
82
|
getEntity().addDescription(interactionDescription.getText(),
|
83
|
CdmStore.getDefaultLanguage());
|
84
|
}
|
85
|
}
|
86
|
}
|