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 java.util.Collection;
|
12
|
|
13
|
import org.eclipse.nebula.widgets.nattable.data.convert.DisplayConverter;
|
14
|
|
15
|
/**
|
16
|
* Converts QuantitativeData of one cell of the character matrix to a String.
|
17
|
*
|
18
|
* @author pplitzner
|
19
|
* @since Dec 1, 2017
|
20
|
*
|
21
|
*/
|
22
|
public class QuantitativeDataNormalModeDisplayConverter extends DisplayConverter {
|
23
|
|
24
|
@Override
|
25
|
public Object canonicalToDisplayValue(Object canonicalValue) {
|
26
|
if (canonicalValue instanceof Collection) {
|
27
|
// Collection.toString() will add [ and ] around
|
28
|
// the values in the Collection
|
29
|
// So by removing the leading and ending
|
30
|
// character, we remove the brackets
|
31
|
String result = canonicalValue.toString();
|
32
|
result = result.substring(1, result.length() - 1);
|
33
|
return result;
|
34
|
}
|
35
|
if(canonicalValue!=null){
|
36
|
return canonicalValue.toString();
|
37
|
}
|
38
|
return null;
|
39
|
}
|
40
|
|
41
|
@Override
|
42
|
public Object displayToCanonicalValue(Object displayValue) {
|
43
|
return displayValue;
|
44
|
}
|
45
|
|
46
|
}
|