ref #7575 small layout changes
[taxeditor.git] / eu.etaxonomy.taxeditor.editor / src / main / java / eu / etaxonomy / taxeditor / editor / descriptiveDataSet / matrix / quantitative / QuantitativeDataNormalModeDisplayConverter.java
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.descriptiveDataSet.matrix.quantitative;
10
11 import org.eclipse.nebula.widgets.nattable.data.convert.DisplayConverter;
12
13 import eu.etaxonomy.cdm.model.description.QuantitativeData;
14 import eu.etaxonomy.taxeditor.editor.descriptiveDataSet.matrix.MatrixUtility;
15
16 /**
17 * Converts QuantitativeData of one cell of the character matrix to a String.
18 *
19 * @author pplitzner
20 * @since Dec 1, 2017
21 *
22 */
23 public class QuantitativeDataNormalModeDisplayConverter extends DisplayConverter {
24
25 @Override
26 public Object canonicalToDisplayValue(Object canonicalValue) {
27 if(canonicalValue instanceof QuantitativeData){
28 return MatrixUtility.getQuantitativeLabel((QuantitativeData) canonicalValue);
29 }
30 if(canonicalValue!=null){
31 return canonicalValue.toString();
32 }
33 return null;
34 }
35
36 @Override
37 public Object displayToCanonicalValue(Object displayValue) {
38 return displayValue;
39 }
40
41 }