Project

General

Profile

Download (1.23 KB) Statistics
| Branch: | Tag: | Revision:
1
/**
2
* Copyright (C) 2017 EDIT
3
* European Distributed Institute of Taxonomy
4
* http://www.e-taxonomy.eu
5
*
6
* The contents of this file are subject to the Mozilla Public License Version 1.1
7
* See LICENSE.TXT at the top of this package for the full license terms.
8
*/
9
package eu.etaxonomy.taxeditor.editor.workingSet.matrix.categorical;
10

    
11
import org.eclipse.nebula.widgets.nattable.data.convert.DisplayConverter;
12

    
13
import eu.etaxonomy.cdm.model.description.CategoricalData;
14
import eu.etaxonomy.cdm.model.description.State;
15
import eu.etaxonomy.taxeditor.model.DescriptionHelper;
16

    
17
/**
18
 * @author pplitzner
19
 * @since Dec 1, 2017
20
 *
21
 */
22
public class CategoricalDataDisplayConverter extends DisplayConverter {
23

    
24
    /**
25
     * {@inheritDoc}
26
     */
27
    @Override
28
    public Object canonicalToDisplayValue(Object canonicalValue) {
29
        if(canonicalValue instanceof CategoricalData){
30
            return DescriptionHelper.getLabel(canonicalValue);
31
        }
32
        else if(canonicalValue instanceof State){
33
            return ((State) canonicalValue).getLabel();
34
        }
35
        return canonicalValue.toString();
36
    }
37

    
38
    /**
39
     * {@inheritDoc}
40
     */
41
    @Override
42
    public Object displayToCanonicalValue(Object displayValue) {
43
        return null;
44
    }
45

    
46
}
(2-2/2)