de.cbb.mplayer.mapping.String2TextFieldMapper.java Source code

Java tutorial

Introduction

Here is the source code for de.cbb.mplayer.mapping.String2TextFieldMapper.java

Source

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package de.cbb.mplayer.mapping;

import com.google.common.base.Strings;
import javafx.scene.control.TextField;

/**
 *
 * @author cbb
 */
public class String2TextFieldMapper extends Mapper<String, TextField> {

    public String2TextFieldMapper(String fieldname, Object object) {
        super(fieldname, object);
    }

    @Override
    public void map(String value) throws Exception {
        TextField tf = (TextField) MappingUtil.getAccessableControl(fieldname, object);
        if (Strings.isNullOrEmpty(value))
            tf.setText("");
        else
            tf.setText(value);

    }

}