All Downloads are FREE. Search and download functionalities are using the official Maven repository.

nz.co.senanque.vaadin.application.MaduraStringToDoubleConverter Maven / Gradle / Ivy

Go to download

Integrates Madura Objects with Vaadin applications including support for dynamic metadata changes (available choices, read/write status of fields etc).

There is a newer version: 3.4.1
Show newest version
package nz.co.senanque.vaadin.application;

import java.text.NumberFormat;
import java.util.Locale;

import com.vaadin.data.util.converter.StringToDoubleConverter;

/**
 * @author Roger Parkinson
 *
 */
public class MaduraStringToDoubleConverter extends StringToDoubleConverter  implements MaduraNumericConverter {
	
	private int fractionDigits = 0;

    protected NumberFormat getFormat(Locale locale) {
        if (locale == null) {
            locale = Locale.getDefault();
        }

        NumberFormat ret = NumberFormat.getNumberInstance(locale);
        ret.setMaximumFractionDigits(fractionDigits);
        ret.setMinimumFractionDigits(fractionDigits);
        return ret;
    }

	public int getFractionDigits() {
		return fractionDigits;
	}

	public void setFractionDigits(int fractionDigits) {
		this.fractionDigits = fractionDigits;
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy