InputDialog, PasswordDialog, InputTextAreaDialog: simplify propertyChange()

This commit is contained in:
Sergey Ponomarev 2024-08-24 14:44:17 +03:00
parent 193a9e4c42
commit 0f6bf8565f
3 changed files with 8 additions and 17 deletions

View File

@ -164,14 +164,11 @@ public final class InputDialog implements PropertyChangeListener {
dialog.setVisible(false);
}
else if (Res.getString("ok").equals(value)) {
stringValue = textArea.getText();
if (stringValue.trim().length() == 0) {
stringValue = textArea.getText().trim();
if (stringValue.isEmpty()) {
stringValue = null;
}
else {
stringValue = stringValue.trim();
}
dialog.setVisible(false);
}
}
}
}

View File

@ -217,13 +217,10 @@ public final class PasswordDialog implements PropertyChangeListener {
dialog.setVisible(false);
}
else if (Res.getString("ok").equals(value)) {
stringValue = String.valueOf(passwordField.getPassword());
if (stringValue.trim().length() == 0) {
stringValue = String.valueOf(passwordField.getPassword()).trim();
if (stringValue.isEmpty()) {
stringValue = null;
}
else {
stringValue = stringValue.trim();
}
dialog.setVisible(false);
}
}

View File

@ -166,14 +166,11 @@ public final class InputTextAreaDialog implements PropertyChangeListener {
dialog.setVisible(false);
}
else if (Res.getString("ok").equals(value)) {
stringValue = textArea.getText();
if (stringValue.trim().length() == 0) {
stringValue = textArea.getText().trim();
if (stringValue.isEmpty()) {
stringValue = "";
}
else {
stringValue = stringValue.trim();
}
dialog.setVisible(false);
}
}
}
}