Project

General

Profile

Download (1.92 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.component;
10

    
11
import com.vaadin.data.Property;
12
import com.vaadin.ui.TextField;
13

    
14
/**
15
 * TextField which has "" as null represnetation, fixed the ugly "null"s in the
16
 * default  TextField implementation in vaadin 7. TODO: this might no longer be
17
 * required in vaadin 8 since it is supposed to have a mechanism to configure
18
 * the null representations.
19
 * <p>
20
 * Additional features:
21
 * <ul>
22
 *    <li>entered text is trimmed</li>
23
 * </ul>
24
 *
25
 *
26
 * @author a.kohlbecker
27
 * @since Dec 21, 2017
28
 *
29
 */
30
public class TextFieldNFix extends TextField {
31

    
32
    private static final long serialVersionUID = -7582619519894748364L;
33

    
34
    /**
35
     * @param format
36
     */
37
    public TextFieldNFix(String format) {
38
        super(format);
39
    }
40

    
41

    
42

    
43
    /**
44
     *
45
     */
46
    public TextFieldNFix() {
47
        super();
48
    }
49

    
50

    
51

    
52
    /**
53
     * @param dataSource
54
     */
55
    public TextFieldNFix(Property dataSource) {
56
        super(dataSource);
57
    }
58

    
59

    
60

    
61
    /**
62
     * @param caption
63
     * @param dataSource
64
     */
65
    public TextFieldNFix(String caption, Property dataSource) {
66
        super(caption, dataSource);
67
    }
68

    
69

    
70

    
71
    /**
72
     * @param caption
73
     * @param value
74
     */
75
    public TextFieldNFix(String caption, String value) {
76
        super(caption, value);
77
        // TODO Auto-generated constructor stub
78
    }
79

    
80

    
81

    
82
    /**
83
     * {@inheritDoc}
84
     */
85
    @Override
86
    public String getNullRepresentation() {
87
        return "";
88
    }
89

    
90

    
91

    
92
    /**
93
     * {@inheritDoc}
94
     */
95
    @Override
96
    protected void setInternalValue(String newValue) {
97
        if(newValue != null){
98
            newValue = newValue.trim();
99
        }
100
        super.setInternalValue(newValue);
101
    }
102

    
103

    
104

    
105

    
106

    
107
}
(8-8/8)