branch develop updated (869e21f -> 6457e31)
This is an automated email from the git hooks/post-receive script. New change to branch develop in repository jaxx. See http://git.nuiton.org/jaxx.git from 869e21f fixes #3606: Add more hooks on ApplicationTableModel new d303fe4 fixes #3607: NumberEditor does not deal well with signed number new 6457e31 fixes #3608: Keep caret position if a bad caracter is given in NumberEditor The 2 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "adds" were already present in the repository and have only been added to this reference. Detailed log of new commits: commit 6457e312c41b346206bf798622e8957b64116fad Author: Tony CHEMIT <chemit@codelutin.com> Date: Thu Jan 1 17:18:03 2015 +0100 fixes #3608: Keep caret position if a bad caracter is given in NumberEditor commit d303fe41d33a8a370d7cca06878b995296a1e6e5 Author: Tony CHEMIT <chemit@codelutin.com> Date: Thu Jan 1 17:17:26 2015 +0100 fixes #3607: NumberEditor does not deal well with signed number Summary of changes: .../jaxx/widgets/number/NumberEditorHandler.java | 34 ++++++++++++++++++++-- 1 file changed, 31 insertions(+), 3 deletions(-) -- To stop receiving notification emails like this one, please contact nuiton.org SCM administrator <admin+scm@nuiton.org>.
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 d303fe41d33a8a370d7cca06878b995296a1e6e5 Author: Tony CHEMIT <chemit@codelutin.com> Date: Thu Jan 1 17:17:26 2015 +0100 fixes #3607: NumberEditor does not deal well with signed number --- .../jaxx/widgets/number/NumberEditorHandler.java | 29 +++++++++++++++++++--- 1 file changed, 26 insertions(+), 3 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 25c18ae..6a5168e 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 @@ -194,6 +194,11 @@ public class NumberEditorHandler implements UIHandler<NumberEditor> { textValid = matcher.matches(); + if (!textValid && model.isCanUseSign() && "-".equals(newText)) { + // limit case when we have only "-" + textValid = true; + } + } else { // check text validity "by hand" @@ -578,7 +583,13 @@ public class NumberEditorHandler implements UIHandler<NumberEditor> { @Override public Integer parse(String textValue) { - return Integer.parseInt(textValue); + Integer v; + if ("-".equals(textValue)) { + v = null; + } else { + v = Integer.parseInt(textValue); + } + return v; } }; numberFactories.put(int.class, integerSupport); @@ -609,7 +620,13 @@ public class NumberEditorHandler implements UIHandler<NumberEditor> { @Override public Float parse(String textValue) { - return Float.parseFloat(textValue); + Float v; + if ("-".equals(textValue)) { + v = null; + } else { + v = Float.parseFloat(textValue); + } + return v; } }; numberFactories.put(float.class, floatSupport); @@ -640,7 +657,13 @@ public class NumberEditorHandler implements UIHandler<NumberEditor> { @Override public Double parse(String textValue) { - return Double.parseDouble(textValue); + Double v; + if ("-".equals(textValue)) { + v = null; + } else { + v = Double.parseDouble(textValue); + } + return v; } }; numberFactories.put(double.class, doubleSupport); -- To stop receiving notification emails like this one, please contact nuiton.org SCM administrator <admin+scm@nuiton.org>.
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 6457e312c41b346206bf798622e8957b64116fad Author: Tony CHEMIT <chemit@codelutin.com> Date: Thu Jan 1 17:18:03 2015 +0100 fixes #3608: Keep caret position if a bad caracter is given in NumberEditor --- .../java/org/nuiton/jaxx/widgets/number/NumberEditorHandler.java | 5 +++++ 1 file changed, 5 insertions(+) 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 6a5168e..19e96c5 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 @@ -231,7 +231,12 @@ public class NumberEditorHandler implements UIHandler<NumberEditor> { log.info("Text [" + newText + "] is not valid, will rollback to previous valid text: " + oldText); } + int caretPosition = ui.getTextField().getCaretPosition() - 1; + ui.getTextField().setText(oldText); + if (caretPosition >= 0) { + ui.getTextField().setCaretPosition(caretPosition); + } } -- To stop receiving notification emails like this one, please contact nuiton.org SCM administrator <admin+scm@nuiton.org>.
participants (1)
-
nuiton.org scm