OpenConcerto

Dépôt officiel du code source de l'ERP OpenConcerto
sonarqube

svn://code.openconcerto.org/openconcerto

Rev

Rev 144 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 144 Rev 156
Line 16... Line 16...
16
import org.openconcerto.utils.io.JSONConverter;
16
import org.openconcerto.utils.io.JSONConverter;
17
 
17
 
18
import net.minidev.json.JSONObject;
18
import net.minidev.json.JSONObject;
19
 
19
 
20
public class LightUITextField extends LightUserControl {
20
public class LightUITextField extends LightUserControl {
-
 
21
 
-
 
22
    public LightUITextField() {
-
 
23
        // Serialization
-
 
24
    }
-
 
25
 
21
    public LightUITextField(final String id) {
26
    public LightUITextField(final String id) {
22
        super(id);
27
        super(id);
23
        this.setType(TYPE_TEXT_FIELD);
28
        this.setType(TYPE_TEXT_FIELD);
24
        this.setValueType(LightUIElement.VALUE_TYPE_STRING);
29
        this.setValueType(LightUIElement.VALUE_TYPE_STRING);
25
    }
30
    }
Line 31... Line 36...
31
    public LightUITextField(final LightUITextField text) {
36
    public LightUITextField(final LightUITextField text) {
32
        super(text);
37
        super(text);
33
    }
38
    }
34
 
39
 
35
    @Override
40
    @Override
36
    public JSONToLightUIConvertor getConvertor() {
-
 
37
        return new JSONToLightUIConvertor() {
-
 
38
            @Override
-
 
39
            public LightUIElement convert(final JSONObject json) {
-
 
40
                return new LightUITextField(json);
-
 
41
            }
-
 
42
        };
-
 
43
    }
-
 
44
 
-
 
45
    @Override
-
 
46
    public Object getValueForContext() {
41
    public Object getValueForContext() {
47
        if (this.getValue() == null || this.getValue().trim().isEmpty()) {
42
        if (this.getValue() == null || this.getValue().trim().isEmpty()) {
48
            return null;
43
            return null;
49
        }
44
        }
50
        return this.getValue();
45
        return this.getValue();