import org.eclipse.nebula.widgets.nattable.layer.LabelStack;
import org.eclipse.nebula.widgets.nattable.layer.cell.IConfigLabelAccumulator;
+import com.sun.org.apache.xalan.internal.utils.FeatureManager.Feature;
+
+import eu.etaxonomy.cdm.api.service.dto.SpecimenRowWrapperDTO;
import eu.etaxonomy.cdm.api.service.dto.TaxonRowWrapperDTO;
-import eu.etaxonomy.cdm.model.description.Feature;
import eu.etaxonomy.cdm.persistence.dto.TaxonNodeDto;
/**
*/
public class CharacterMatrixConfigLabelAccumulator implements IConfigLabelAccumulator {
+ public static final String HAS_DEFAULT = "HAS_DEFAULT";
+ public static final String DEFAULT_OVERRIDDEN = "DEFAULT_OVERRIDDEN";
public static final String QUANTITATIVE = "QUANTITATIVE";
public static final String CATEGORICAL = "CATEGORICAL";
public static final String CATEGORICAL_EDITABLE = CATEGORICAL+"_EDITABLE";
else{
Feature feature = matrix.getFeatures().get(columnPosition-CharacterMatrix.LEADING_COLUMN_COUNT);
configLabels.addLabel(MatrixUtility.getProperty(feature));
+ // check for default values
+ if(rowObject instanceof SpecimenRowWrapperDTO){
+ SpecimenRowWrapperDTO specimenRowWrapper = (SpecimenRowWrapperDTO)rowObject;
+ if(hasDefaultValue(feature, specimenRowWrapper)){
+ configLabels.addLabel(HAS_DEFAULT);
+ }
+ if(specimenRowWrapper.getDataValueForFeature(feature)!=null){
+ configLabels.addLabel(DEFAULT_OVERRIDDEN);
+ }
+ }
+
if(feature.isSupportsCategoricalData()){
configLabels.addLabel(CATEGORICAL);
if(isEditable){
}
}
}
+
+ private boolean hasDefaultValue(Feature feature, SpecimenRowWrapperDTO specimenRowWrapper) {
+ TaxonRowWrapperDTO defaultDescription = specimenRowWrapper.getDefaultDescription();
+ return defaultDescription.getDescription().getElements().stream().anyMatch(element->element.getFeature().equals(feature));
+ }
}
DisplayMode.NORMAL,
CharacterMatrix.LABEL_TAXON_LITERATURE_DESCRIPTION);
+ Style hasDefaultValueStyle = new Style();
+ hasDefaultValueStyle.setAttributeValue(
+ CellStyleAttributes.BACKGROUND_COLOR,
+ GUIHelper.COLOR_GRAY);
+ configRegistry.registerConfigAttribute(
+ CellConfigAttributes.CELL_STYLE,
+ hasDefaultValueStyle,
+ DisplayMode.NORMAL,
+ CharacterMatrixConfigLabelAccumulator.HAS_DEFAULT);
+
+ Style defaultOverriddenStyle = new Style();
+ defaultOverriddenStyle.setAttributeValue(
+ CellStyleAttributes.BACKGROUND_COLOR,
+ GUIHelper.COLOR_RED);
+ configRegistry.registerConfigAttribute(
+ CellConfigAttributes.CELL_STYLE,
+ defaultOverriddenStyle,
+ DisplayMode.NORMAL,
+ CharacterMatrixConfigLabelAccumulator.DEFAULT_OVERRIDDEN);
+
//cell painter for supplemental data
configRegistry.registerConfigAttribute(
CellConfigAttributes.CELL_PAINTER,