3 * Copyright (C) 2007 EDIT
4 * European Distributed Institute of Taxonomy
5 * http://www.e-taxonomy.eu
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.
11 package eu
.etaxonomy
.taxeditor
.ui
.section
.description
.detail
;
13 import org
.eclipse
.swt
.SWT
;
15 import eu
.etaxonomy
.cdm
.model
.description
.TaxonInteraction
;
16 import eu
.etaxonomy
.cdm
.model
.taxon
.Taxon
;
17 import eu
.etaxonomy
.taxeditor
.store
.CdmStore
;
18 import eu
.etaxonomy
.taxeditor
.ui
.forms
.CdmFormFactory
;
19 import eu
.etaxonomy
.taxeditor
.ui
.forms
.ICdmFormElement
;
20 import eu
.etaxonomy
.taxeditor
.ui
.forms
.TextWithLabelElement
;
21 import eu
.etaxonomy
.taxeditor
.ui
.forms
.CdmFormFactory
.SelectionType
;
22 import eu
.etaxonomy
.taxeditor
.ui
.selection
.TaxonSelectionElement
;
25 * <p>TaxonInteractionDetailElement class.</p>
28 * @created Jun 10, 2010
31 public class TaxonInteractionDetailElement
extends AbstractDetailedDescriptionDetailElement
<TaxonInteraction
>{
33 private TaxonSelectionElement taxonSelection
;
34 private TextWithLabelElement interactionDescription
;
37 * <p>Constructor for TaxonInteractionDetailElement.</p>
39 * @param formFactory a {@link eu.etaxonomy.taxeditor.ui.forms.CdmFormFactory} object.
40 * @param formElement a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement} object.
41 * @param entity a {@link eu.etaxonomy.cdm.model.description.TaxonInteraction} object.
44 public TaxonInteractionDetailElement(CdmFormFactory formFactory
,
45 ICdmFormElement formElement
, TaxonInteraction entity
, int style
) {
46 super(formFactory
, formElement
, entity
, style
);
51 protected void createControls(ICdmFormElement formElement
,
52 TaxonInteraction entity
, int style
) {
53 taxonSelection
= (TaxonSelectionElement
) formFactory
.createSelectionElement(SelectionType
.TAXON
, getConversationHolder(), this, null, entity
.getTaxon2(), SWT
.WRAP
);
55 interactionDescription
= formFactory
.createMultilineTextWithLabel(this, "Description", 200, SWT
.WRAP
);
56 interactionDescription
.setText(entity
.getDescription(CdmStore
.getDefaultLanguage()));
62 public void handleEvent(Object eventSource
) {
63 if(eventSource
== taxonSelection
){
64 getEntity().setTaxon2( (Taxon
) taxonSelection
.getEntity());
65 }else if(eventSource
== interactionDescription
){
66 getEntity().addDescription(interactionDescription
.getText(), CdmStore
.getDefaultLanguage());