Code Monkey home page Code Monkey logo

numberfield's People

Contributors

ansku avatar ollitietavainenvaadin avatar thisisbinh avatar victor-tarasov avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar

numberfield's Issues

Decimal separator is deleted

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.

Default validator validates on string with wrong decimal symbol

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.

When used with a Binder to bind to an Integer field and the value length is > 3 digits, I get java.lang.NumberFormatException

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.

InputPrompt string not shown

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...

numberField

After lose focus

numberField

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.