smaller changes to display taxon interactions
[taxeditor.git] / eu.etaxonomy.taxeditor.store / src / main / java / eu / etaxonomy / taxeditor / ui / section / description / detail / TaxonInteractionDetailElement.java
index b54d55833478b313fc69c731d35402e6188500e7..972dd847bdd138687a99f0b923d0f66ecd023726 100644 (file)
@@ -1,22 +1,25 @@
 // $Id$
 /**
  * Copyright (C) 2007 EDIT
- * European Distributed Institute of Taxonomy 
+ * European Distributed Institute of Taxonomy
  * http://www.e-taxonomy.eu
- * 
+ *
  * The contents of this file are subject to the Mozilla Public License Version 1.1
  * See LICENSE.TXT at the top of this package for the full license terms.
  */
 
 package eu.etaxonomy.taxeditor.ui.section.description.detail;
 
-import org.eclipse.swt.SWT;
+import java.util.Map;
 
+import eu.etaxonomy.cdm.model.common.CdmBase;
+import eu.etaxonomy.cdm.model.common.Language;
+import eu.etaxonomy.cdm.model.common.LanguageString;
 import eu.etaxonomy.cdm.model.description.TaxonInteraction;
 import eu.etaxonomy.cdm.model.taxon.Taxon;
 import eu.etaxonomy.taxeditor.store.CdmStore;
-import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
 import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
+import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
 import eu.etaxonomy.taxeditor.ui.element.TextWithLabelElement;
 import eu.etaxonomy.taxeditor.ui.selection.EntitySelectionElement;
 
@@ -24,7 +27,7 @@ import eu.etaxonomy.taxeditor.ui.selection.EntitySelectionElement;
  * <p>
  * TaxonInteractionDetailElement class.
  * </p>
- * 
+ *
  * @author n.hoffmann
  * @created Jun 10, 2010
  * @version 1.0
@@ -39,7 +42,7 @@ public class TaxonInteractionDetailElement extends
         * <p>
         * Constructor for TaxonInteractionDetailElement.
         * </p>
-        * 
+        *
         * @param formFactory
         *            a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory}
         *            object.
@@ -61,16 +64,21 @@ public class TaxonInteractionDetailElement extends
        @Override
        protected void createControls(ICdmFormElement formElement,
                        TaxonInteraction entity, int style) {
-               taxonSelection = formFactory
-                               .createSelectionElement(Taxon.class,
-                                               getConversationHolder(), this, "Taxon",
-                                               entity.getTaxon2(), EntitySelectionElement.NOTHING,
-                                               SWT.WRAP);
 
-               interactionDescription = formFactory.createMultilineTextWithLabel(this,
-                               "Description", 200, SWT.WRAP);
-               interactionDescription.setText(entity.getDescription(CdmStore
-                               .getDefaultLanguage()));
+           taxonSelection = formFactory
+                .createSelectionElement(Taxon.class,
+                        getConversationHolder(), formElement, "Taxon",
+                        CdmBase.deproxy(entity.getTaxon2(),Taxon.class),
+                        EntitySelectionElement.ALL, style);
+
+           interactionDescription = formFactory.createMultiLineTextWithLabel(
+                formElement, "Relationship to the unit:", 200, style);
+        Map<Language, LanguageString> descriptions = entity.getDescription();
+
+        if (descriptions.get(CdmStore.getDefaultLanguage()) != null) {
+            interactionDescription.setText(descriptions.get(
+                    CdmStore.getDefaultLanguage()).getText());
+        }
        }
 
        /** {@inheritDoc} */