Remove identifier and taxon associations from bulk editor details view
authorPatrick Plitzner <p.plitzner@bgbm.org>
Wed, 28 Oct 2015 17:41:33 +0000 (18:41 +0100)
committerPatrick Plitzner <p.plitzner@bgbm.org>
Thu, 29 Oct 2015 10:10:33 +0000 (11:10 +0100)
 - reduce space taken by taxon associaton section #5348

eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/association/TaxonAssociationDetailElement.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/detail/DetailsViewer.java

index a7d9f73c40b7607dd2ae8f8900d9c9b50aff4fcd..4ff63d538b054474d860e11497154cc29f6843fa 100644 (file)
@@ -70,18 +70,20 @@ public class TaxonAssociationDetailElement extends AbstractCdmDetailElement<Deri
         //TODO add context menu for deleting associations
 
         Collection<TaxonBase<?>> associatedTaxa = CdmStore.getService(IOccurrenceService.class).listAssociatedTaxa(entity.innerDerivedUnit(), null, null, null, null);
-        if(associatedTaxa.isEmpty()){
-            Label associationsLabel = formFactory.createLabel(getLayoutComposite(), "Individuals Associations");
-            associationsLabel.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
+        Collection<SpecimenTypeDesignation> typeDesignations = CdmStore.getService(IOccurrenceService.class).listTypeDesignations(entity.innerDerivedUnit(), null, null, null, null);
 
+        if(!associatedTaxa.isEmpty()){
             associationsViewer = new TableViewer(getLayoutComposite(), SWT.FULL_SELECTION);
             associationsViewer.getTable().setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
             associationsViewer.setContentProvider(new ArrayContentProvider());
             associationsViewer.setInput(associatedTaxa);
             associationsViewer.addDoubleClickListener(this);
         }
+        else{
+            Label label = formFactory.createLabel(getLayoutComposite(), "No associations");
+            label.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
+        }
 
-        Collection<SpecimenTypeDesignation> typeDesignations = CdmStore.getService(IOccurrenceService.class).listTypeDesignations(entity.innerDerivedUnit(), null, null, null, null);
         //TODO implement service method for this which is just used in the label provider
         Collection<TaxonBase<?>> typedTaxa = new HashSet<TaxonBase<?>>();
         for (SpecimenTypeDesignation specimenTypeDesignation : typeDesignations) {
@@ -112,9 +114,6 @@ public class TaxonAssociationDetailElement extends AbstractCdmDetailElement<Deri
         //empty
     }
 
-    /* (non-Javadoc)
-     * @see org.eclipse.jface.viewers.IDoubleClickListener#doubleClick(org.eclipse.jface.viewers.DoubleClickEvent)
-     */
     @Override
     public void doubleClick(DoubleClickEvent event) {
         if(event.getSelection() instanceof IStructuredSelection){
index 051397d9c5a915761a5b9fba53e0a0537208082e..6a0dab25f8ac9b57a3da8a371495f890d70fed8a 100644 (file)
@@ -577,21 +577,22 @@ public class DetailsViewer extends AbstractCdmDataViewer {
             FieldUnitDetailSection fieldUnitDetailSection = formFactory.createFieldUnitDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE);
             addPart(fieldUnitDetailSection);
         }
+        else{
 
+            if(PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_TAXON_ASSOCIATIONS)){
+                formFactory.createHorizontalSeparator(parent, SWT.BORDER);
+                TaxonAssociationDetailSection taxonAssociationDetailSection = formFactory.createTaxonAssociationDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
+                addPart(taxonAssociationDetailSection);
+            }
+            formFactory.createHorizontalSeparator(parent, SWT.BORDER);
+            IdentifierDetailSection identifierDetailSection = formFactory.createIdentifierDetailSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
+            addPart(identifierDetailSection);
+        }
         if(!PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.DETERMINATION_ONLY_FOR_FIELD_UNITS)){
             formFactory.createHorizontalSeparator(parent, SWT.BORDER);
             DeterminationDetailSection determinationDetailSection = formFactory.createDeterminationDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE);
             addPart(determinationDetailSection);
         }
-        if(PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_TAXON_ASSOCIATIONS)){
-            formFactory.createHorizontalSeparator(parent, SWT.BORDER);
-            TaxonAssociationDetailSection taxonAssociationDetailSection = formFactory.createTaxonAssociationDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
-            addPart(taxonAssociationDetailSection);
-        }
-
-        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
-        IdentifierDetailSection identifierDetailSection = formFactory.createIdentifierDetailSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
-        addPart(identifierDetailSection);
 
     }