commit 1cc08dc4601ad0aa15cdb4f3aba27066ba4bdebd
Author: Patrick Plitzner <p.plitzner@bgbm.org>
Date:   Mon Aug 27 09:35:24 2018 +0200

    ref #7674 Disable cell editor for aggregated taxon descriptions

diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/descriptiveDataSet/matrix/CellEditorDataConversionConfiguration.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/descriptiveDataSet/matrix/CellEditorDataConversionConfiguration.java
index 94943d1a0..fd5d39573 100644
--- a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/descriptiveDataSet/matrix/CellEditorDataConversionConfiguration.java
+++ b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/descriptiveDataSet/matrix/CellEditorDataConversionConfiguration.java
@@ -78,7 +78,7 @@ final class CellEditorDataConversionConfiguration extends AbstractRegistryConfig
                 EditConfigAttributes.CELL_EDITABLE_RULE,
                 IEditableRule.ALWAYS_EDITABLE,
                 DisplayMode.EDIT,
-                CharacterMatrixConfigLabelAccumulator.CATEGORICAL
+                CharacterMatrixConfigLabelAccumulator.CATEGORICAL_EDITABLE
                 );
         //add display converter for string representation
         configRegistry.registerConfigAttribute(
@@ -91,7 +91,7 @@ final class CellEditorDataConversionConfiguration extends AbstractRegistryConfig
         configRegistry.registerConfigAttribute(EditConfigAttributes.CELL_EDITOR,
                 new CategoricalDataCellEditor(matrix, new CategoricalComboBoxDataProvider(matrix)),
                 DisplayMode.EDIT,
-                CharacterMatrixConfigLabelAccumulator.CATEGORICAL
+                CharacterMatrixConfigLabelAccumulator.CATEGORICAL_EDITABLE
                 );
 
 
@@ -103,14 +103,14 @@ final class CellEditorDataConversionConfiguration extends AbstractRegistryConfig
                 EditConfigAttributes.CELL_EDITABLE_RULE,
                 IEditableRule.ALWAYS_EDITABLE,
                 DisplayMode.EDIT,
-                CharacterMatrixConfigLabelAccumulator.QUANTITATIVE
+                CharacterMatrixConfigLabelAccumulator.QUANTITATIVE_EDITABLE
                 );
         //add display converter for string representation
         configRegistry.registerConfigAttribute(
                 CellConfigAttributes.DISPLAY_CONVERTER,
                 new QuantitativeDataEditModeDisplayConverter(),
                 DisplayMode.EDIT,
-                CharacterMatrixConfigLabelAccumulator.QUANTITATIVE);
+                CharacterMatrixConfigLabelAccumulator.QUANTITATIVE_EDITABLE);
         configRegistry.registerConfigAttribute(
                 CellConfigAttributes.DISPLAY_CONVERTER,
                 new QuantitativeDataNormalModeDisplayConverter(),
@@ -122,13 +122,13 @@ final class CellEditorDataConversionConfiguration extends AbstractRegistryConfig
                 EditConfigAttributes.OPEN_IN_DIALOG,
                 Boolean.TRUE,
                 DisplayMode.EDIT,
-                CharacterMatrixConfigLabelAccumulator.QUANTITATIVE);
+                CharacterMatrixConfigLabelAccumulator.QUANTITATIVE_EDITABLE);
         //register quantitative editor
         configRegistry.registerConfigAttribute(
                 EditConfigAttributes.CELL_EDITOR,
                 new QuantitativeDataDialogEditor(matrix),
                 DisplayMode.EDIT,
-                CharacterMatrixConfigLabelAccumulator.QUANTITATIVE);
+                CharacterMatrixConfigLabelAccumulator.QUANTITATIVE_EDITABLE);
         // configure custom dialog settings
         Map<String, Object> editDialogSettings = new HashMap<>();
         editDialogSettings.put(ICellEditDialog.DIALOG_SHELL_TITLE, "Quantitative Data");
@@ -146,7 +146,7 @@ final class CellEditorDataConversionConfiguration extends AbstractRegistryConfig
                 EditConfigAttributes.EDIT_DIALOG_SETTINGS,
                 editDialogSettings,
                 DisplayMode.EDIT,
-                CharacterMatrixConfigLabelAccumulator.QUANTITATIVE);
+                CharacterMatrixConfigLabelAccumulator.QUANTITATIVE_EDITABLE);
     }
 
 }
diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/descriptiveDataSet/matrix/CharacterMatrixConfigLabelAccumulator.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/descriptiveDataSet/matrix/CharacterMatrixConfigLabelAccumulator.java
index 18fbef09f..084eab571 100644
--- a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/descriptiveDataSet/matrix/CharacterMatrixConfigLabelAccumulator.java
+++ b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/descriptiveDataSet/matrix/CharacterMatrixConfigLabelAccumulator.java
@@ -12,9 +12,7 @@ import org.eclipse.nebula.widgets.nattable.layer.LabelStack;
 import org.eclipse.nebula.widgets.nattable.layer.cell.IConfigLabelAccumulator;
 
 import eu.etaxonomy.cdm.api.service.dto.TaxonRowWrapperDTO;
-import eu.etaxonomy.cdm.model.common.MarkerType;
 import eu.etaxonomy.cdm.model.description.Feature;
-import eu.etaxonomy.cdm.model.description.TaxonDescription;
 import eu.etaxonomy.cdm.model.taxon.TaxonNode;
 
 /**
@@ -26,6 +24,8 @@ public class CharacterMatrixConfigLabelAccumulator implements IConfigLabelAccumu
 
     public static final String QUANTITATIVE = "QUANTITATIVE";
     public static final String CATEGORICAL = "CATEGORICAL";
+    public static final String CATEGORICAL_EDITABLE = CATEGORICAL+"_EDITABLE";
+    public static final String QUANTITATIVE_EDITABLE = QUANTITATIVE+"_EDITABLE";
 
     private CharacterMatrix matrix;
 
@@ -36,16 +36,16 @@ public class CharacterMatrixConfigLabelAccumulator implements IConfigLabelAccumu
 
     @Override
     public void accumulateConfigLabels(LabelStack configLabels, int columnPosition, int rowPosition) {
+        boolean isEditable = true;
+
         Object rowObject = matrix.getBodyDataProvider().getRowObject(rowPosition);
         if(rowObject instanceof TaxonNode){
             configLabels.addLabel(CharacterMatrix.LABEL_TAXON_ROW);
         }
         else if(rowObject instanceof TaxonRowWrapperDTO){
-            TaxonDescription taxonDescription = ((TaxonRowWrapperDTO) rowObject).getDescription();
-            boolean isComputed = taxonDescription.getMarkers().stream()
-            .anyMatch(marker->marker.getMarkerType().equals(MarkerType.COMPUTED()));
-            if(isComputed){
+            if(MatrixUtility.isEntityComputed(((TaxonRowWrapperDTO) rowObject).getDescription())){
                 configLabels.addLabel(CharacterMatrix.LABEL_TAXON_AGGREGATED_DESCRIPTION);
+                isEditable = false;
             }
             else{
                 configLabels.addLabel(CharacterMatrix.LABEL_TAXON_DESCRIPTION);
@@ -69,9 +69,15 @@ public class CharacterMatrixConfigLabelAccumulator implements IConfigLabelAccumu
             configLabels.addLabel(MatrixUtility.getProperty(feature));
             if(feature.isSupportsCategoricalData()){
                 configLabels.addLabel(CATEGORICAL);
+                if(isEditable){
+                    configLabels.addLabel(CATEGORICAL_EDITABLE);
+                }
             }
             else if(feature.isSupportsQuantitativeData()){
                 configLabels.addLabel(QUANTITATIVE);
+                if(isEditable){
+                    configLabels.addLabel(QUANTITATIVE_EDITABLE);
+                }
             }
         }
     }
diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/descriptiveDataSet/matrix/MatrixUtility.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/descriptiveDataSet/matrix/MatrixUtility.java
index d0ff00485..94c737d2a 100644
--- a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/descriptiveDataSet/matrix/MatrixUtility.java
+++ b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/descriptiveDataSet/matrix/MatrixUtility.java
@@ -11,6 +11,8 @@ package eu.etaxonomy.taxeditor.editor.descriptiveDataSet.matrix;
 import java.util.Set;
 import java.util.stream.Collectors;
 
+import eu.etaxonomy.cdm.model.common.AnnotatableEntity;
+import eu.etaxonomy.cdm.model.common.MarkerType;
 import eu.etaxonomy.cdm.model.description.DescriptiveDataSet;
 import eu.etaxonomy.cdm.model.description.Feature;
 import eu.etaxonomy.cdm.model.description.QuantitativeData;
@@ -67,6 +69,20 @@ public class MatrixUtility {
                 +(max==null?"":"("+max.toString()+")"); //$NON-NLS-1$
     }
 
+    /**
+     * Checks if the given entity has any marker of type
+     * {@link MarkerType#COMPUTED()}
+     *
+     * @param entity
+     *            the entity to check
+     * @return <code>true</code> of a computed marker was found,
+     *         <code>false</code> otherwise
+     */
+    public static boolean isEntityComputed(AnnotatableEntity entity){
+        return entity.getMarkers().stream()
+                .anyMatch(marker->marker.getMarkerType().equals(MarkerType.COMPUTED()));
+    }
+
 
     public static Classification getClassificationForDescriptiveDataSet(DescriptiveDataSet descriptiveDataSet){
         Set<TaxonNode> taxonSubtreeFilter = descriptiveDataSet.getTaxonSubtreeFilter();
