smaller changes to display taxon interactions
authorKatja Luther <k.luther@bgbm.org>
Tue, 8 Nov 2016 09:03:57 +0000 (10:03 +0100)
committerKatja Luther <k.luther@bgbm.org>
Tue, 8 Nov 2016 09:04:35 +0000 (10:04 +0100)
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/description/detail/TaxonInteractionDetailElement.java

index 3a56e5c1f9e58750b6352a0052fd3c66aa10d185..972dd847bdd138687a99f0b923d0f66ecd023726 100644 (file)
@@ -1,18 +1,20 @@
 // $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.hibernate.HibernateProxyHelper;
+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;
@@ -25,7 +27,7 @@ import eu.etaxonomy.taxeditor.ui.selection.EntitySelectionElement;
  * <p>
  * TaxonInteractionDetailElement class.
  * </p>
- * 
+ *
  * @author n.hoffmann
  * @created Jun 10, 2010
  * @version 1.0
@@ -40,7 +42,7 @@ public class TaxonInteractionDetailElement extends
         * <p>
         * Constructor for TaxonInteractionDetailElement.
         * </p>
-        * 
+        *
         * @param formFactory
         *            a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory}
         *            object.
@@ -62,17 +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,
-                               "Relationship to the taxon:", 200, SWT.WRAP);
-               entity = HibernateProxyHelper.deproxy(entity, TaxonInteraction.class);
-               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} */