use of com.haulmont.chile.core.datatypes.FormatStrings in project cuba by cuba-platform.
the class DateDatatype method format.
@Override
public String format(Object value, Locale locale) {
if (value == null) {
return "";
}
FormatStrings formatStrings = AppBeans.get(FormatStringsRegistry.class).getFormatStrings(locale);
if (formatStrings == null) {
return format(value);
}
DateFormat format = new SimpleDateFormat(formatStrings.getDateFormat());
return format.format(value);
}
use of com.haulmont.chile.core.datatypes.FormatStrings in project cuba by cuba-platform.
the class DoubleDatatype method format.
@Override
public String format(Object value, Locale locale) {
if (value == null) {
return "";
}
FormatStrings formatStrings = AppBeans.get(FormatStringsRegistry.class).getFormatStrings(locale);
if (formatStrings == null) {
return format(value);
}
DecimalFormatSymbols formatSymbols = formatStrings.getFormatSymbols();
NumberFormat format = new DecimalFormat(formatStrings.getDoubleFormat(), formatSymbols);
return format.format(value);
}
use of com.haulmont.chile.core.datatypes.FormatStrings in project cuba by cuba-platform.
the class IntegerDatatype method parse.
@Override
public Integer parse(String value, Locale locale) throws ParseException {
if (StringUtils.isBlank(value))
return null;
FormatStrings formatStrings = AppBeans.get(FormatStringsRegistry.class).getFormatStrings(locale);
if (formatStrings == null)
return parse(value);
DecimalFormatSymbols formatSymbols = formatStrings.getFormatSymbols();
NumberFormat format = new DecimalFormat(formatStrings.getIntegerFormat(), formatSymbols);
return parse(value, format).intValue();
}
use of com.haulmont.chile.core.datatypes.FormatStrings in project cuba by cuba-platform.
the class LongDatatype method format.
@Override
public String format(Object value, Locale locale) {
if (value == null) {
return "";
}
FormatStrings formatStrings = AppBeans.get(FormatStringsRegistry.class).getFormatStrings(locale);
if (formatStrings == null) {
return format(value);
}
DecimalFormatSymbols formatSymbols = formatStrings.getFormatSymbols();
NumberFormat format = new DecimalFormat(formatStrings.getIntegerFormat(), formatSymbols);
return format.format(value);
}
use of com.haulmont.chile.core.datatypes.FormatStrings in project cuba by cuba-platform.
the class TimeDatatype method format.
@Override
public String format(Object value, Locale locale) {
if (value == null) {
return "";
}
FormatStrings formatStrings = AppBeans.get(FormatStringsRegistry.class).getFormatStrings(locale);
if (formatStrings == null) {
return format(value);
}
DateFormat format = new SimpleDateFormat(formatStrings.getTimeFormat());
format.setLenient(false);
return format.format(value);
}
Aggregations