ansku / numberfield Goto Github PK
View Code? Open in Web Editor NEWHome Page: https://vaadin.com/directory#!addon/numberfield-vaadin-7
License: Apache License 2.0
Home Page: https://vaadin.com/directory#!addon/numberfield-vaadin-7
License: Apache License 2.0
When pressing number key and decimal separator key immediatrly after, the decimal separator is deleted.
field.setDecimalSeparator('.');
for ex "2." -> "2".
So that it is not deleted, you need to wait for the time before entering the separator.
I'm using a decimal format with space as grouping char and comma as decimal char. But, a value such as 123,32
is determined to be invalid. The validator uses a good regex, but the value it validates is not the input string though. When using the setValue()
method, the value is set to String noExponent = BigDecimal.valueOf(newValue.doubleValue()).toPlainString();
instead of using the format info in NumberField.
Since the default validator in many cases get a erroneous result, I think it should be disabled by default.
Could you provide a maven artifact for your addon?
Hello, thank you for the useful addon NumberField.
I am using org.vaadin.ui.numberfield 0.2.0 with Vaadin 8
When used with the com.vaadin.data.Binder and bound to an Integer field on an entity, I receive the following exception:
java.lang.NumberFormatException: For input string: "2,003"
at sun.misc.FloatingDecimal.readJavaFormatString(FloatingDecimal.java:2043)
at sun.misc.FloatingDecimal.parseDouble(FloatingDecimal.java:110)
at java.lang.Double.parseDouble(Double.java:538)
at java.lang.Double.valueOf(Double.java:502)
at org.vaadin.ui.NumberField.getValueAsFormattedDecimalNumber(NumberField.java:320)
at org.vaadin.ui.NumberField.updateFormattedValue(NumberField.java:307)
at org.vaadin.ui.NumberField.lambda$0(NumberField.java:173)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.vaadin.event.ListenerMethod.receiveEvent(ListenerMethod.java:510)
at com.vaadin.event.EventRouter.fireEvent(EventRouter.java:211)
at com.vaadin.event.EventRouter.fireEvent(EventRouter.java:174)
at com.vaadin.server.AbstractClientConnector.fireEvent(AbstractClientConnector.java:1033)
at com.vaadin.ui.AbstractField.setValue(AbstractField.java:144)
at com.vaadin.ui.AbstractTextField.setValue(AbstractTextField.java:98)
at com.vaadin.ui.AbstractTextField.setValue(AbstractTextField.java:47)
at com.vaadin.data.Binder$BindingImpl.initFieldValue(Binder.java:893)
at com.vaadin.data.Binder$BindingImpl.access$100(Binder.java:766)
at com.vaadin.data.Binder$BindingBuilderImpl.bind(Binder.java:593)
at com.cffnow.ui.controls.editors.base.IFieldRegistrarAspect.registerField(IFieldRegistrarAspect.java:29)
at com.cffnow.ui.controls.editors.equipment.components.EquipmentEditor.getYearField(EquipmentEditor.java:288)
So the integer value is 2003, but for some reason a comma is appearing, and causing a NumberFormatException.
I verified that when the value's length is 3 or less, this is not an issue.
Hi...
I have an issue using NumberField, particullary when set the input promput data...
I am assigning the input prompt data, but never it shown... only when set focus to the numberfield and leave it, the input prompt is showed.
nfZone = new NumberField();
nfZone.setInputPrompt("ZONE");
nfZone.setDecimalAllowed(false);
nfZone.setGroupingUsed(false);
nfZone.setId("idZone");
nfZone.setDescription("Zone prospected.");
nfZone.setWidth(3, Unit.EM);
nfZone.setImmediate(true);
nfZone.addTextChangeListener(keyPressed);
nfZone.setNegativeAllowed(false);
This is the result when open the view...
After lose focus
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.