Project

General

Profile

Download (1.26 KB) Statistics
| Branch: | Tag: | Revision:
1
/**
2
* Copyright (C) 2018 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.cdm.vaadin.component;
10

    
11
import com.vaadin.data.util.converter.Converter.ConversionException;
12

    
13
import eu.etaxonomy.cdm.vaadin.util.converter.GeoLocationConverterValidator;
14
import eu.etaxonomy.cdm.vaadin.util.converter.GeoLocationConverterValidator.Axis;
15

    
16
/**
17
 * @author a.kohlbecker
18
 * @since Nov 22, 2018
19
 *
20
 */
21
public class LongLatField extends TextFieldNFix {
22

    
23
    private static final long serialVersionUID = -7794173729396522366L;
24

    
25
    private GeoLocationConverterValidator converterValidator;
26

    
27
    private Axis axis;
28

    
29
    public LongLatField(String caption, GeoLocationConverterValidator.Axis axis){
30
        super(caption);
31
        this.axis = axis;
32
        converterValidator = new GeoLocationConverterValidator(axis);
33
        setConverter(converterValidator);
34
        addValidator(converterValidator);
35
    }
36

    
37
    @Override
38
    protected String getConversionError(Class<?> dataSourceType,
39
            ConversionException e) {
40
        return "Invalid " + axis.name().toLowerCase() + " value";
41
    }
42

    
43
}
(9-9/12)