mirror of
https://github.com/DSheirer/sdrtrunk.git
synced 2026-11-09 15:17:24 -05:00
Update IntegerFormatter.java for negative squelch value (#2187)
Two issues: (1)documentation for change.getText() says it can be an empty string but never null. (2)Need to allow for typing a minus sign before validating min/max.
This commit is contained in:
@@ -85,7 +85,7 @@ public class IntegerFormatter extends TextFormatter<Integer>
|
||||
public Change apply(Change change)
|
||||
{
|
||||
//Only validate if the user added text to the control. Otherwise, allow it to go through
|
||||
if(change.getText() != null)
|
||||
if(!change.getText().equals(""))
|
||||
{
|
||||
String updatedText = change.getControlNewText();
|
||||
|
||||
@@ -93,6 +93,12 @@ public class IntegerFormatter extends TextFormatter<Integer>
|
||||
{
|
||||
return change;
|
||||
}
|
||||
|
||||
// don't validate yet if input is only a minus sign
|
||||
if(updatedText.equals("-"))
|
||||
{
|
||||
return change;
|
||||
}
|
||||
|
||||
if(!updatedText.matches(DECIMAL_REGEX) || !isValid(updatedText))
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user