formatting contortions

I want to capture and display dates at the minute resolution, in a table and in a form.

I currently have a weird collection of generated columns and field factories, that I wrote by stumbling along as I was first learning Vaadin.

I should be able to define a “startTime” property in my Field factory, set the resolution there, and be done with it. I should be able to use the FieldFactory for both forms and Tables.

  • I should not have to define a columnGenerator to format it. Table should just use the fieldFactory and use a read-only rendering of the field. Right now it does a toString(), which blissfully ignores the resolution.
  • I should not have to write my own routine because there is no “toString()” that takes into account the date resolution.

Right now, I have to override Table() to override getPropertyValue(), and I have to override the various fields to have a proper toString().

The same logic goes for other fields like Select – the toString() should give me a readable list, not the current nonsense.

PropertyFormatter looks like a good idea, but again, there has to be a way to say,
ONCE
, what the formatting for an item is like. In most instances, the value I show in a table, and the value I edit in that table, and the value I edit in a popup or detail form, all need to be consistent. Right now, this is waaaaaay too much work.

Hi,

Yes, it’s known that PropertyFormatter doesn’t really solve the problems it should solve and using a generated column is easier for the task, which creates a problem when you want to edit the values. As it is now, it’s more suitable for Forms than Tables, and in any case it’s awkward.

A better solution is proposed for Vaadin 7, see the
Property Formatting and Parsing
proposal. You’re welcome to comment on the proposal and if you have ideas what the new solution should be like, those would be most welcome.