NumberField is present in API ?

Hi to All!!!

So we have API:
-TextField;
-DateField
…atc

but what about
-IntegerField
-DecimalField (for locale)

I missed something…

Please advice what should I do to have an ability to input numbers in editor

does this help?

http://vaadin.com/directory#addon/stepper

Definitely would be awesome to have this as vaadin core & ui polished to match vaadin’s other widgets. Spinners are common widgets.

Vin

Not realy what I acspected for

I’m assuming you want to be able to enter numeric values and have them formatted correctly.

You can format values in a TextField by using a PropertyFormatter - this will ensure the text is converted to and from the Property in a given format - i.e. it parses the text the user entered, and converts into an object, and also formats an object into text for display.

You can easily implement a PropertyFormatter that delegates to a DecimalFormat to give locale-specific numeric formatting. It essentially operates as a converty proxy between the field and the underlying property.

PropertyFormatters will not prevent you from entering non-numeric characters in the browser (client), mind you. There are various add-ons in the directory that might be of use in this regard. I’ve not used any of them myself, yet

http://vaadin.com/directory#addon/dwtextfields (Has a decimal text field)
http://vaadin.com/directory#addon/autoreplacefield (Has integer field, and allows replacement of text on client side via regex)
http://vaadin.com/directory#addon/maskedtextfield (Enter according to a mask)

HTH,

Charles

Hi,

I’ve downloaded one of the add ons. As I see now, its quite easy to implement a digits only field. And I think, a good API fitting all needs in all situations would be hard to design. Still, a hint how to do it would be nice in die JavaDoc or in the Vaadin books. In business applications an Integer field where you can enter letters makes a terrible impression. So its quite an important thing to have a key filter.

Greetings

Bruno

Here is my investigation on available addons for numeric fields, that prevent the user to input others things than digits and accepting double values :


Dw textfield
: Weird to use

Auto replace field
: Simple and nice, only a slight problem of rendering and selection

Masked TextField
: Handle only masks, I needed something to prevent the user to enter character others than digits.

Numeric field
Compiled in Java 7…

Ikarus
: Not a fan of the numeric field, weird stuff happens when entering numbers, and integration with maven is bad