Revision 1cc08dc4
Added by Patrick Plitzner over 5 years ago
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/descriptiveDataSet/matrix/CharacterMatrixConfigLabelAccumulator.java | ||
---|---|---|
12 | 12 |
import org.eclipse.nebula.widgets.nattable.layer.cell.IConfigLabelAccumulator; |
13 | 13 |
|
14 | 14 |
import eu.etaxonomy.cdm.api.service.dto.TaxonRowWrapperDTO; |
15 |
import eu.etaxonomy.cdm.model.common.MarkerType; |
|
16 | 15 |
import eu.etaxonomy.cdm.model.description.Feature; |
17 |
import eu.etaxonomy.cdm.model.description.TaxonDescription; |
|
18 | 16 |
import eu.etaxonomy.cdm.model.taxon.TaxonNode; |
19 | 17 |
|
20 | 18 |
/** |
... | ... | |
26 | 24 |
|
27 | 25 |
public static final String QUANTITATIVE = "QUANTITATIVE"; |
28 | 26 |
public static final String CATEGORICAL = "CATEGORICAL"; |
27 |
public static final String CATEGORICAL_EDITABLE = CATEGORICAL+"_EDITABLE"; |
|
28 |
public static final String QUANTITATIVE_EDITABLE = QUANTITATIVE+"_EDITABLE"; |
|
29 | 29 |
|
30 | 30 |
private CharacterMatrix matrix; |
31 | 31 |
|
... | ... | |
36 | 36 |
|
37 | 37 |
@Override |
38 | 38 |
public void accumulateConfigLabels(LabelStack configLabels, int columnPosition, int rowPosition) { |
39 |
boolean isEditable = true; |
|
40 |
|
|
39 | 41 |
Object rowObject = matrix.getBodyDataProvider().getRowObject(rowPosition); |
40 | 42 |
if(rowObject instanceof TaxonNode){ |
41 | 43 |
configLabels.addLabel(CharacterMatrix.LABEL_TAXON_ROW); |
42 | 44 |
} |
43 | 45 |
else if(rowObject instanceof TaxonRowWrapperDTO){ |
44 |
TaxonDescription taxonDescription = ((TaxonRowWrapperDTO) rowObject).getDescription(); |
|
45 |
boolean isComputed = taxonDescription.getMarkers().stream() |
|
46 |
.anyMatch(marker->marker.getMarkerType().equals(MarkerType.COMPUTED())); |
|
47 |
if(isComputed){ |
|
46 |
if(MatrixUtility.isEntityComputed(((TaxonRowWrapperDTO) rowObject).getDescription())){ |
|
48 | 47 |
configLabels.addLabel(CharacterMatrix.LABEL_TAXON_AGGREGATED_DESCRIPTION); |
48 |
isEditable = false; |
|
49 | 49 |
} |
50 | 50 |
else{ |
51 | 51 |
configLabels.addLabel(CharacterMatrix.LABEL_TAXON_DESCRIPTION); |
... | ... | |
69 | 69 |
configLabels.addLabel(MatrixUtility.getProperty(feature)); |
70 | 70 |
if(feature.isSupportsCategoricalData()){ |
71 | 71 |
configLabels.addLabel(CATEGORICAL); |
72 |
if(isEditable){ |
|
73 |
configLabels.addLabel(CATEGORICAL_EDITABLE); |
|
74 |
} |
|
72 | 75 |
} |
73 | 76 |
else if(feature.isSupportsQuantitativeData()){ |
74 | 77 |
configLabels.addLabel(QUANTITATIVE); |
78 |
if(isEditable){ |
|
79 |
configLabels.addLabel(QUANTITATIVE_EDITABLE); |
|
80 |
} |
|
75 | 81 |
} |
76 | 82 |
} |
77 | 83 |
} |
Also available in: Unified diff
ref #7674 Disable cell editor for aggregated taxon descriptions