Custom property formatter on form

I’ve a Form where an property of source Item need to be formatter by an custom format.

Source property (of my own bean) is a Integer, but need to be formatted as a Currency-like format.

I tried to implement my own
PropertyFormatter
, and setup it inside my
FieldFactory.createField
for this form as

TextField tf = new TextField("Price");
Property original = item.getItemProperty("price");
tf.setPropertyDataSource(new MyPriceFormatter(original));
return tf;

But as I see from the logs, only
format()
method is called. But
parse()
method is never used,
setValue
is never called

What’s wrong with my code? How to use custom
PropertyFormatter
for forms? Or how to add custom format for form’s field?

asked also at SO: http://stackoverflow.com/questions/6647222/vaadin-property-formatter-on-form

Value doesn’t propagate to datasource on value change unless you commit or set that textfield to writethrough mode.

This has come up before as well: the values of Form fields are set when calling Form.setItemDataSource()
after
the field is created by the field factory. Therefore, the later setPropertyDataSource() replaces the data source you set in the field factory.

You could e.g. use FieldWrapper in the
CustomField add-on
to do the conversions.