Project

General

Profile

Download (1.5 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.cdm.vaadin.view.registration;
10

    
11
import java.util.Locale;
12

    
13
import com.vaadin.data.util.converter.Converter;
14
import com.vaadin.server.FontAwesome;
15

    
16
/**
17
 * @author a.kohlbecker
18
 * @since Mar 7, 2017
19
 *
20
 */
21
public class RegistrationTypeConverter implements Converter<String, RegistrationType> {
22
    @Override
23
    public RegistrationType convertToModel(String value, Class<? extends RegistrationType> targetType,
24
            Locale locale) throws com.vaadin.data.util.converter.Converter.ConversionException {
25
        // not implemented
26
        return null;
27
    }
28

    
29
    @Override
30
    public String convertToPresentation(RegistrationType value, Class<? extends String> targetType,
31
            Locale locale) throws com.vaadin.data.util.converter.Converter.ConversionException {
32
        if(value.equals(RegistrationType.NAME)) {
33
            return FontAwesome.TAG.getHtml();
34
        }
35
        if(value.equals(RegistrationType.TYPIFICATION)) {
36
            return FontAwesome.TAGS.getHtml();
37
        }
38
        return FontAwesome.WARNING.getHtml();
39
    }
40

    
41
    @Override
42
    public Class<RegistrationType> getModelType() {
43
        return RegistrationType.class;
44
    }
45

    
46
    @Override
47
    public Class<String> getPresentationType() {
48
        return String.class;
49
    }
50
}
(10-10/19)