This is an automated email from the git hooks/post-receive script. New commit to branch develop in repository jaxx. See http://git.nuiton.org/jaxx.git commit d491aac4542ba76d50bb6e098860f2943055e3c7 Author: Tony CHEMIT <chemit@codelutin.com> Date: Thu Jan 1 17:43:52 2015 +0100 fixes #3607: improve also start limit cases --- .../jaxx/widgets/number/NumberEditorHandler.java | 26 +++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/jaxx-widgets-number/src/main/java/org/nuiton/jaxx/widgets/number/NumberEditorHandler.java b/jaxx-widgets-number/src/main/java/org/nuiton/jaxx/widgets/number/NumberEditorHandler.java index 5efc900..d9e8618 100644 --- a/jaxx-widgets-number/src/main/java/org/nuiton/jaxx/widgets/number/NumberEditorHandler.java +++ b/jaxx-widgets-number/src/main/java/org/nuiton/jaxx/widgets/number/NumberEditorHandler.java @@ -560,7 +560,13 @@ public class NumberEditorHandler implements UIHandler<NumberEditor> { @Override public Byte parse(String textValue) { - return Byte.parseByte(textValue); + Byte v; + if (NULL_LIMIT_INTS.contains(textValue)) { + v = null; + } else { + v = Byte.parseByte(textValue); + } + return v; } }; numberFactories.put(byte.class, byteSupport); @@ -574,7 +580,13 @@ public class NumberEditorHandler implements UIHandler<NumberEditor> { @Override public Short parse(String textValue) { - return Short.parseShort(textValue); + Short v; + if (NULL_LIMIT_INTS.contains(textValue)) { + v = null; + } else { + v = Short.parseShort(textValue); + } + return v; } }; numberFactories.put(short.class, shortSupport); @@ -589,7 +601,7 @@ public class NumberEditorHandler implements UIHandler<NumberEditor> { @Override public Integer parse(String textValue) { Integer v; - if ("-".equals(textValue)) { + if (NULL_LIMIT_INTS.contains(textValue)) { v = null; } else { v = Integer.parseInt(textValue); @@ -626,7 +638,7 @@ public class NumberEditorHandler implements UIHandler<NumberEditor> { @Override public Float parse(String textValue) { Float v; - if ("-".equals(textValue) || "-.".equals(textValue)) { + if (NULL_LIMIT_DECIMALS.contains(textValue)) { v = null; } else { boolean addSign = false; @@ -674,7 +686,7 @@ public class NumberEditorHandler implements UIHandler<NumberEditor> { @Override public Double parse(String textValue) { Double v; - if ("-".equals(textValue)) { + if (NULL_LIMIT_DECIMALS.contains(textValue)) { v = null; } else { @@ -738,4 +750,8 @@ public class NumberEditorHandler implements UIHandler<NumberEditor> { } + protected static final ImmutableSet<String> NULL_LIMIT_DECIMALS = ImmutableSet.copyOf(new String[]{"-", ".", "-."}); + + protected static final ImmutableSet<String> NULL_LIMIT_INTS = ImmutableSet.copyOf(new String[]{"-"}); + } -- To stop receiving notification emails like this one, please contact nuiton.org SCM administrator <admin+scm@nuiton.org>.