Project

General

Profile

Download (1.58 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.vaadin.mvp;
10

    
11
import com.vaadin.ui.Field;
12

    
13
import eu.etaxonomy.vaadin.util.PropertyIdPath;
14

    
15
/**
16
 * See {@link {@link AbstractPresenter#openPopupEditor(Class, eu.etaxonomy.cdm.vaadin.event.AbstractEditorAction)}}
17
 *
18
 * @author a.kohlbecker
19
 * @since May 18, 2018
20
 *
21
 */
22
public class BoundField {
23

    
24
    Field<?> field;
25
    PropertyIdPath propertyIdPath;
26

    
27
    /**
28
     * @param field
29
     * @param propertyId
30
     */
31
    public BoundField(Field<?> field, PropertyIdPath propertyIdPath) {
32
        super();
33
        this.field = field;
34
        this.propertyIdPath = propertyIdPath;
35
    }
36

    
37
    /**
38
     * @return the field
39
     */
40
    public <T> Field<T> getField(Class<T> fieldValueType) {
41
        return (Field<T>)field;
42
    }
43

    
44
    public Field<?> getField() {
45
        return field;
46
    }
47

    
48
    /**
49
     * @return the propertyId
50
     */
51
    public PropertyIdPath getPropertyIdPath() {
52
        return propertyIdPath;
53
    }
54

    
55
    /**
56
     * Null-save method to check for equality. Will always return <code>false</code> in case the internal
57
     * propertyId is <code>null</code>.
58
     *
59
     * @param propertyId
60
     * @return
61
     */
62
    public boolean matchesPropertyIdPath(String propertyIdPath) {
63
        if(this.propertyIdPath == null){
64
            return false;
65
        }
66
        return this.propertyIdPath.matches(propertyIdPath);
67
    }
68

    
69
}
(12-12/13)