textfield.setFormat() to be deprecated?

While working on couple of bugs, it started to seem that our design of TextField.setFormat(…) is confusing. In my opinion that API should be marked as deprecated 5.3.0 (before the end of beta). Better solution is proposed on http://dev.itmill.com/ticket/2078

Please answer the poll.

Wow… That was a quick response.

This sounds better although it makes accessing real datasource a bit harder.

Double d = (Double) tf.getPropertyDatasource().getPropertyDatasource().getValue();

I voted “no objections”

Thoughts: applying formatting while using a FieldFactory will be made (much) less intuitive this way. Same goes for the basic, no datasource, I-have-this-textfield-that-I-want-to-format.
At the very least we need some good examples and use-cases.

(note: while the deprecated method will still work, we can not expect new users to use it)

We should consider adding client-server masking feature in the future. This would probably resolve these issues and complement the actual formatting.

IMO, masking API should be declarative and trivial to use. Something like:
textfield.setMask(“### ###,##$”);

Any ideas on where masking have been nicely implemented?

Someone objects? Description on problems would be great, this would help us to resolve them…

Masked input example:

The against vote is mine. I don’t know about the technical superiority of the proposed solution, my problem is that it hides the feature from the user quite well.

User: “Let’s see, I want to have a formatting for my TextField. I wonder if there is a method for that, such as a ‘setFormat()’ or something… Nope, damn.”

It’s not so intuitive that you can do formatting with a special data source. Mentioning it in documentation doesn’t help if you don’t know it’s there.

You are correct about his. Abovementioned setMask() would probably alleviate the problem.

Still the best resolution would be to advertise features explicitly - in FeatureBrowser. We have tons of features, but many of them are well hidden…