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

it.amattioli.guidate.converters.YesNoConverter Maven / Gradle / Ivy

There is a newer version: 1.0.7
Show newest version
package it.amattioli.guidate.converters;

import java.util.ResourceBundle;

import org.zkoss.util.Locales;
import org.zkoss.zk.ui.Component;
import org.zkoss.zkplus.databind.TypeConverter;

public class YesNoConverter implements TypeConverter {

	@Override
	public Object coerceToBean(Object val, Component comp) {
		throw new UnsupportedOperationException();
	}

	@Override
	public Object coerceToUi(Object val, Component comp) {
		if (val == null) {
            return "";
        } else {
        	return getResources().getString(val.toString());
        }
	}

	private ResourceBundle getResources() {
		return ResourceBundle.getBundle("it.amattioli.guidate.converters.YesNo", Locales.getCurrent());
	}

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy