numberfield7 - NumberField7 Add-on
TextField which allows only number input
This addon is a modification of TextField, which accepts only number input and has new properties.
- Enable/disable negative values #setSigned. Default true.
- Enable/disable number grouping #setUseGrouping. Default false.
- Setting grouping separator #setGroupingSeparator. Default character dot character.
- Enable/disable decimal numbers #setDecimal. Default false.
- Setting decimal separator #setDecimalSeparator. Default value space character.
If you want to get converted value, you need to use binder and set custom converter by calling binderBuilder.forField(field)
.withConverter(createStringToIntegerConverter())
For demo you could checkout and run demo app from here.
Sample code
public NumberField createInstance() { NumberField field = new NumberField("Amount"); field.setSigned(false); // disable negative sign, default true field.setUseGrouping(true); // enable grouping, default false field.setGroupingSeparator(' '); // set grouping separator ' ' field.setDecimal(true); // enables input of decimal numbers, default false field.setDecimalSeparator('.'); // set decimal separator, default '.' field.setConverter(converter); // custom converter return field; }
Links
Compatibility
Was this helpful? Need more help?
Leave a comment or a question below. You can also join
the chat on Discord or
ask questions on StackOverflow.
Version
Upgrade to Vaadin 8
- Released
- 2017-07-11
- Maturity
- EXPERIMENTAL
- License
- Apache License 2.0
Compatibility
- Framework
- Vaadin 8.0+
- Vaadin 7.4+ in 0.0.2
- Browser
- N/A
numberfield7 - NumberField7 Add-on - Vaadin Add-on Directory
TextField which allows only number inputIssue Tracker
numberfield7 - NumberField7 Add-on version 0.0.2
This is refactored modification of previous add-on https://vaadin.com/directory#!addon/numberfield7
- Deleted min, max values for validation and default converter.
- Added NumberfFieldWidget class.
- Deleted demo project source code from add-on project.
- Bug fix with saving cursor position.
- Deleted click and focus handlers.
- Simplified processing algorithm.
- Deleted build-in converter.
- Decimal-length property.
- Added isDecimal property.
numberfield7 - NumberField7 Add-on version 0.0.4
[Bug #2](https://github.com/ojkey/master/issues/2) fixing: deleted dependency with parent project
numberfield7 - NumberField7 Add-on version 0.0.5
Upgrade to Vaadin 8