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
.element
.CdmFormFactory
;
19 import eu
.etaxonomy
.taxeditor
.ui
.element
.ICdmFormElement
;
20 import eu
.etaxonomy
.taxeditor
.ui
.element
.TextWithLabelElement
;
21 import eu
.etaxonomy
.taxeditor
.ui
.selection
.EntitySelectionElement
;
25 * TaxonInteractionDetailElement class.
29 * @created Jun 10, 2010
32 public class TaxonInteractionDetailElement
extends
33 AbstractDetailedDescriptionDetailElement
<TaxonInteraction
> {
35 private EntitySelectionElement
<Taxon
> taxonSelection
;
36 private TextWithLabelElement interactionDescription
;
40 * Constructor for TaxonInteractionDetailElement.
44 * a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory}
47 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
50 * a {@link eu.etaxonomy.cdm.model.description.TaxonInteraction}
55 public TaxonInteractionDetailElement(CdmFormFactory formFactory
,
56 ICdmFormElement formElement
, TaxonInteraction entity
, int style
) {
57 super(formFactory
, formElement
, entity
, style
);
62 protected void createControls(ICdmFormElement formElement
,
63 TaxonInteraction entity
, int style
) {
64 taxonSelection
= formFactory
65 .createSelectionElement(Taxon
.class,
66 getConversationHolder(), this, "Taxon",
67 entity
.getTaxon2(), EntitySelectionElement
.NOTHING
,
70 interactionDescription
= formFactory
.createMultilineTextWithLabel(this,
71 "Description", 200, SWT
.WRAP
);
72 interactionDescription
.setText(entity
.getDescription(CdmStore
73 .getDefaultLanguage()));
78 public void handleEvent(Object eventSource
) {
79 if (eventSource
== taxonSelection
) {
80 getEntity().setTaxon2(taxonSelection
.getEntity());
81 } else if (eventSource
== interactionDescription
) {
82 getEntity().putDescription(CdmStore
.getDefaultLanguage(), interactionDescription
.getText());