Fixes the issue "Non valid number as font size results in an uncaught exception."#7438
Conversation
|
Please fix the checkstyle issues, otherwise lgtm! |
calixtus
left a comment
There was a problem hiding this comment.
Please use org.jabref.gui.util.OnlyIntegerFormatter
|
@calixtus The problem is that the OnlyIntegerFormatter returns null for no value and this will throw an exception in the spinner IntegerConverter (was my first attempt either) |
|
Just to comment on that @Siedlerchr, the |
|
Isn't it possible to pass a default value as an argument to the constructor? |
|
@calixtus Are you referring to the |
|
The Database tests fail. Can someone elaborate on this. |
|
The database test sometimes fail for no reason, not related to you changes |
I was referring to the OnlyIntegerFormatter. But I am satisfied. Thank you for your work here. |
|
@calixtus you are welcome. |
|
@calixtus I think you need to approve before we can merge, since you requested changes. |
tobiasdiez
left a comment
There was a problem hiding this comment.
Thanks! A few very minor remarks from my side. Apart from this, +1 for merge.
| if (Pattern.matches("\\d*", c.getText())) { | ||
| return c; | ||
| } | ||
| c.setText("0"); |
There was a problem hiding this comment.
I think returning null here is slightly better, at least according to the documentation "Returning null rejects the change." https://docs.oracle.com/javase/8/javafx/api/javafx/scene/control/TextFormatter.html#getFilter--
There was a problem hiding this comment.
See the comments in this thread. Returning null will produce an exception in the spinner
| private final ControlsFxVisualizer validationVisualizer = new ControlsFxVisualizer(); | ||
|
|
||
| // The fontSizeFormatter formats the input given to the fontSize spinner so that non valid values cannot be entered. | ||
| private TextFormatter<Integer> fontSizeFormatter = new TextFormatter<Integer>(new IntegerStringConverter(), 9, |
There was a problem hiding this comment.
As this might be handy also in other places, I would propose to extract this to a static method in the a helper class gui.util.TextFormatter
|
|
||
| // The fontSizeFormatter formats the input given to the fontSize spinner so that non valid values cannot be entered. | ||
| private TextFormatter<Integer> fontSizeFormatter = new TextFormatter<Integer>(new IntegerStringConverter(), 9, | ||
| c -> { |
There was a problem hiding this comment.
please don't use abbreviations as variable names. Here change would be good.
* upstream/master: Bump pascalgn/automerge-action from v0.13.0 to v0.13.1 (#7445) Auto-approve depend-a-bot-PRs (#7332) Clarify that changelog is user-facing Remove unmaintained AUTHORS file Fixes the issue "Non valid number as font size results in an uncaught exception." (#7438) Zbmath fetcher (#7440) Bump me.champeau.gradle.jmh from 0.5.2 to 0.5.3 (#7444) Bump styfle/cancel-workflow-action from 0.7.0 to 0.8.0 (#7446)
Fixes #7415