Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    SpinnerItem causes NumberFormatException

    SmartClient Version: SNAPSHOT_v12.1d_2019-11-02/PowerEdition Deployment (built 2019-11-02)

    I'm getting this exception on SpinnerItems:

    Error: java.lang.NumberFormatException: 0.004 does not have either positive or negative affixes.

    The exception is being thrown by: package com.google.gwt.i18n.client.NumberFormat.

    The exception doesn't cause any problems per se, but I don't understand why it seems to be constantly thrown on every mouse up/down of the the spinner.

    I suspect it is caused by the Validator defined on the spinner.

    Question: Is there something I'm missing or can do to suppress the constant exceptions?

    The Spinner is simply defined:


    Code:
    String check = "foo_bar";
    SpinnerItem spinner = new SpinnerItem(check + "_Slack",  check.replaceAll("_", " ") );
      spinner.setValue(0);
    
    
             Validator spinnerValidator = new Validator();
              spinnerValidator.setType(ValidatorType.ISFLOAT);
              spinner.setValidators(spinnerValidator);
    
                    spinner.setCriterionGetter(new FormItemCriterionGetter() {
    
                        @Override
                        public Criterion getCriterion(DynamicForm form, FormItem item) {
                            Criterion result = null;
                            if (item.getValue() != null) {
                                if (!check.equals("Double_Clocking")) {
                                    result = new Criterion(item.getName(), OperatorId.EQUALS, 0 - ((Number) item.getValue()).floatValue());
                                } else {
                                    result = new Criterion(item.getName(), OperatorId.EQUALS, ((Number) item.getValue()).floatValue());
                                }
                            }
                            return result;
                        }
    
                        @Override
                        public Criterion getCriterion(DynamicForm form, FormItem item, TextMatchStyle textMatchStyle) {
                            return getCriterion(form, item);
                        }
                    });
                    spinner.setMin(0.0);
                    spinner.setStep(.001);
                    spinner.setWidth(200);
                    spinner.setTitleOrientation(TitleOrientation.TOP);
                    spinner.setHeight(25);
    
                    spinner.setSaveOnEnter(true);
                    spinner.addKeyPressHandler(new KeyPressHandler() {
    
                        @Override
                        public void onKeyPress(KeyPressEvent event) {
                            if (event.getKeyName().equals("Enter")) {    
                                this.focusInNextTabElement();
                            }
                        }
                    });
    Last edited by tece321; 17 Dec 2019, 14:31.

    #2
    Using your code, we are not able to reproduce this exception.

    Perhaps you have installed global number or date formatting logic, maybe via the SimpleType system, that is required to reproduce the problem?

    Or perhaps it can only be reproduced if a specific locale is loaded?

    Either way, let us know if you can reproduce thisnoutside of your complete application, and if so, what else is required.

    Comment


      #3
      OK thanks.

      We are not making use of the SimpleType system -as far as I can tell from a code search.

      We will attempt to reproduce this in a standalone application. But that will take some time.

      Comment

      Working...
      X