This class can be used to implement formatting for any type of Property datasources. The idea is to connect this as proxy between UI component and the original datasource.
For example
adds formatter for Double-typed property that extends standard "1.0" notation with more zeroes. textfield.setPropertyDataSource(new PropertyFormatter(property) { public String format(Object value) { return ((Double) value).toString() + "000000000"; } public Object parse(String formattedValue) throws Exception { return Double.parseDouble(formattedValue); } });
|
|