Add description types to description detail element
authorPatrick Plitzner <p.plitzner@bgbm.org>
Mon, 23 Sep 2019 12:39:21 +0000 (14:39 +0200)
committerPatrick Plitzner <p.plitzner@bgbm.org>
Mon, 23 Sep 2019 12:39:21 +0000 (14:39 +0200)
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/description/DescriptionDetailElement.java

index 305e10396a76664619f0c46e7998c708385fbc7a..fe4c3f3cc5fd15aec3e70abb221236ac9abab9bc 100644 (file)
 package eu.etaxonomy.taxeditor.ui.section.description;
 
 import java.util.Arrays;
+import java.util.stream.Collectors;
 
 import org.eclipse.jface.util.PropertyChangeEvent;
 
 import eu.etaxonomy.cdm.model.description.DescriptionBase;
 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.section.AbstractIdentifiableEntityDetailElement;
 
 /**
@@ -28,6 +30,7 @@ import eu.etaxonomy.taxeditor.ui.section.AbstractIdentifiableEntityDetailElement
 public class DescriptionDetailElement extends AbstractIdentifiableEntityDetailElement<DescriptionBase> {
 
 //     private EntitySelectionElement<FeatureTree> selection_featureTree;
+    private TextWithLabelElement txtDescriptionTypes;
 
        public DescriptionDetailElement(CdmFormFactory cdmFormFactory,
                        ICdmFormElement formElement, int style) {
@@ -42,6 +45,8 @@ public class DescriptionDetailElement extends AbstractIdentifiableEntityDetailEl
                // it is similar to a FeatureTree (you can get this information from a feature tree) but not the same.
                // Please correct this once it is clear what descriptive system will be used for in CDM
 //             selection_featureTree = formFactory.createSelectionElement(FeatureTree.class, getConversationHolder(), formElement, "Feature Tree", null, EntitySelectionElement.ALL, style);
+        txtDescriptionTypes = formFactory.createTextWithLabelElement(formElement, "Types", entity.getTypes().stream().map(type->type.toString()).collect(Collectors.joining(",")), style);
+        txtDescriptionTypes.setEnabled(false);
        }
 
     @Override
@@ -49,7 +54,7 @@ public class DescriptionDetailElement extends AbstractIdentifiableEntityDetailEl
         super.updateContent();
         toggleable_cache.setEnabled(getEntity().isProtectedTitleCache());
         setIrrelevant(toggleable_cache.getState(),
-                Arrays.asList(new Object[] { toggleable_cache}));
+                Arrays.asList(new Object[] { txtDescriptionTypes, toggleable_cache}));
     }
 
     @Override