Sunday, November 3, 2013

Re: IntegerBox and Editor framework question

You could also:

  • use another editor (possibly wrapping or delegating to an IntegerBox) that makes sure getValue is never 'null', or
  • make the "parent" editor a ValueAwareEditor and handle the field binding manually in the setValue() and flush() methods

On Saturday, November 2, 2013 11:10:55 AM UTC+1, Nicolas Weeger wrote:
Hello everyone.


I'm using an IntegerBox in an Editor<> widget, with a POJO having an
associated getter and setter for an "int", and a SimpleBeanEditorDriver to
bind the editor and the POJO.


When I call the driver's flush() method, if the contents of the IntegerBox is
not a valid integer (empty string for instance), a NPE will be raised when
attempting to convert from the IntegerBox's Integer to the setter's int.


The obvious workarounds I see are either to manually check the content before
calling flush(), or changing my "int" property to "Integer" (but in this case I
can't have my POJO be a JSON overlay type, something that is useful).


Am I missing some obvious solution?



Any hints appreciated :)



Kind regards


Nicolas

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/groups/opt_out.

No comments:

Post a Comment