Project

General

Profile

« Previous | Next » 

Revision 9c384528

Added by Patrick Plitzner almost 5 years ago

fix #8333 Show modifiers for states in Character Matrix

View differences:

eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/descriptiveDataSet/matrix/categorical/CategoricalDataDisplayConverter.java
16 16
import eu.etaxonomy.cdm.model.description.State;
17 17
import eu.etaxonomy.cdm.persistence.dto.TermDto;
18 18
import eu.etaxonomy.cdm.remote.l10n.TermRepresentation_L10n;
19
import eu.etaxonomy.taxeditor.model.DescriptionHelper;
19 20

  
20 21
/**
21 22
 * Converts CategoricalData and States of one cell of the character matrix to a
......
33 34
    @Override
34 35
    public Object canonicalToDisplayValue(Object canonicalValue) {
35 36
        if(canonicalValue instanceof CategoricalData){
36
            CategoricalData categoricalData = (CategoricalData)canonicalValue;
37
            String result = categoricalData.getStatesOnly().toString();
38
            result = result.substring(1, result.length() - 1);
39
            return result;
37
            String text = DescriptionHelper.getLabel(canonicalValue);
38
            return text.equals(DescriptionHelper.NO_LABEL_STRING)?"":text;
40 39
        }
41 40
        else if(canonicalValue instanceof State){
42 41
            return ((State) canonicalValue).getLabel();
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/model/DescriptionHelper.java
571 571

  
572 572
	private static DescriptionBuilder<QuantitativeData> quantitativeDescriptionBuilder = new DefaultQuantitativeDescriptionBuilder();
573 573
	private static DescriptionBuilder<CategoricalData> categoricalDescriptionBuilder = new DefaultCategoricalDescriptionBuilder();
574
    public static final String NO_LABEL_STRING = "[no label]";
574 575

  
575 576

  
576 577
	/**
......
720 721
	 * @return a {@link java.lang.String} object.
721 722
	 */
722 723
	public static String getLabel(Object element){
723
	    String noLabelString = "[no label]";
724 724
		if (element instanceof FeatureNodeContainer){
725 725
			return getFeatureNodeContainerText((FeatureNodeContainer) element);
726 726
		}
......
730 730
		else if(element instanceof CategoricalData){
731 731
			String categoricalDataText = getCategoricalDataText((CategoricalData) element);
732 732
			if(categoricalDataText==null || categoricalDataText.isEmpty()){
733
			    categoricalDataText = noLabelString;
733
			    categoricalDataText = NO_LABEL_STRING;
734 734
			}
735 735
            return categoricalDataText;
736 736
		}
......
746 746
		else if (element instanceof QuantitativeData) {
747 747
			String quantitativeDataText = getQuantitativeDataText((QuantitativeData) element);
748 748
			if(quantitativeDataText==null || quantitativeDataText.isEmpty()){
749
                quantitativeDataText = noLabelString;
749
                quantitativeDataText = NO_LABEL_STRING;
750 750
			}
751 751
            return quantitativeDataText;
752 752
		}

Also available in: Unified diff