Project

General

Profile

« Previous | Next » 

Revision fd14dd4d

Added by Patrick Plitzner about 6 years ago

ref #7095 Add unit to column header of quant. data

View differences:

eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/workingSet/matrix/SpecimenColumnPropertyAccessor.java
20 20
import eu.etaxonomy.cdm.model.description.CategoricalData;
21 21
import eu.etaxonomy.cdm.model.description.DescriptionElementBase;
22 22
import eu.etaxonomy.cdm.model.description.Feature;
23
import eu.etaxonomy.cdm.model.description.MeasurementUnit;
23 24
import eu.etaxonomy.cdm.model.description.SpecimenDescription;
24 25
import eu.etaxonomy.cdm.model.description.State;
25 26
import eu.etaxonomy.cdm.model.description.StateData;
27
import eu.etaxonomy.taxeditor.model.MessagingUtils;
26 28

  
27 29
/**
28 30
 * @author pplitzner
......
38 40
    public SpecimenColumnPropertyAccessor(final List<Feature> features) {
39 41
        this.features = features;
40 42
        for (Feature feature : features) {
41
            propertyToLabelMap.put(feature.getLabel(), feature.getLabel());
43
            String featureLabel = feature.getLabel();
44
            String property = featureLabel;
45
            //show unit for quantitative data
46
            if(feature.isSupportsQuantitativeData()){
47
                Set<MeasurementUnit> recommendedMeasurementUnits = feature.getRecommendedMeasurementUnits();
48
                if(recommendedMeasurementUnits.size()!=1){
49
                    MessagingUtils.error(SpecimenColumnPropertyAccessor.class, "Only one unit is allowed for quantitative data", null);
50
                    continue;
51
                }
52
                MeasurementUnit unit = recommendedMeasurementUnits.iterator().next();
53
                featureLabel += " ["+unit.getLabel()+"]";
54
            }
55
            propertyToLabelMap.put(property, featureLabel);
42 56
        }
43 57
    }
44 58

  

Also available in: Unified diff