11 |
11 |
import org.eclipse.nebula.widgets.nattable.layer.LabelStack;
|
12 |
12 |
import org.eclipse.nebula.widgets.nattable.layer.cell.IConfigLabelAccumulator;
|
13 |
13 |
|
|
14 |
import com.sun.org.apache.xalan.internal.utils.FeatureManager.Feature;
|
|
15 |
|
|
16 |
import eu.etaxonomy.cdm.api.service.dto.SpecimenRowWrapperDTO;
|
14 |
17 |
import eu.etaxonomy.cdm.api.service.dto.TaxonRowWrapperDTO;
|
15 |
|
import eu.etaxonomy.cdm.model.description.Feature;
|
16 |
18 |
import eu.etaxonomy.cdm.persistence.dto.TaxonNodeDto;
|
17 |
19 |
|
18 |
20 |
/**
|
... | ... | |
22 |
24 |
*/
|
23 |
25 |
public class CharacterMatrixConfigLabelAccumulator implements IConfigLabelAccumulator {
|
24 |
26 |
|
|
27 |
public static final String HAS_DEFAULT = "HAS_DEFAULT";
|
|
28 |
public static final String DEFAULT_OVERRIDDEN = "DEFAULT_OVERRIDDEN";
|
25 |
29 |
public static final String QUANTITATIVE = "QUANTITATIVE";
|
26 |
30 |
public static final String CATEGORICAL = "CATEGORICAL";
|
27 |
31 |
public static final String CATEGORICAL_EDITABLE = CATEGORICAL+"_EDITABLE";
|
... | ... | |
85 |
89 |
else{
|
86 |
90 |
Feature feature = matrix.getFeatures().get(columnPosition-CharacterMatrix.LEADING_COLUMN_COUNT);
|
87 |
91 |
configLabels.addLabel(MatrixUtility.getProperty(feature));
|
|
92 |
// check for default values
|
|
93 |
if(rowObject instanceof SpecimenRowWrapperDTO){
|
|
94 |
SpecimenRowWrapperDTO specimenRowWrapper = (SpecimenRowWrapperDTO)rowObject;
|
|
95 |
if(hasDefaultValue(feature, specimenRowWrapper)){
|
|
96 |
configLabels.addLabel(HAS_DEFAULT);
|
|
97 |
}
|
|
98 |
if(specimenRowWrapper.getDataValueForFeature(feature)!=null){
|
|
99 |
configLabels.addLabel(DEFAULT_OVERRIDDEN);
|
|
100 |
}
|
|
101 |
}
|
|
102 |
|
88 |
103 |
if(feature.isSupportsCategoricalData()){
|
89 |
104 |
configLabels.addLabel(CATEGORICAL);
|
90 |
105 |
if(isEditable){
|
... | ... | |
99 |
114 |
}
|
100 |
115 |
}
|
101 |
116 |
}
|
|
117 |
|
|
118 |
private boolean hasDefaultValue(Feature feature, SpecimenRowWrapperDTO specimenRowWrapper) {
|
|
119 |
TaxonRowWrapperDTO defaultDescription = specimenRowWrapper.getDefaultDescription();
|
|
120 |
return defaultDescription.getDescription().getElements().stream().anyMatch(element->element.getFeature().equals(feature));
|
|
121 |
}
|
102 |
122 |
}
|
ref #8450 Set config labels according to default values