Compare commits
2 commits
e5c518d078
...
08b916c5c5
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
08b916c5c5 | ||
|
|
1e5383a332 |
2 changed files with 18 additions and 8 deletions
|
|
@ -151,14 +151,18 @@ public class MainController implements Initializable {
|
|||
Log.v(this.getClass().getSimpleName(), "Login shown");
|
||||
mainContainer.setVisible(false);
|
||||
loadingController.hide();
|
||||
Timer t = new Timer();
|
||||
t.schedule(new TimerTask() {
|
||||
@Override
|
||||
public void run() {
|
||||
openEditUsernameDialog(isError ? EditUsernameDialogController.Mode.ERROR : EditUsernameDialogController.Mode.INITIAL);
|
||||
t.cancel();
|
||||
}
|
||||
}, 500);
|
||||
if (isError) {
|
||||
Timer t = new Timer();
|
||||
t.schedule(new TimerTask() {
|
||||
@Override
|
||||
public void run() {
|
||||
openEditUsernameDialog(EditUsernameDialogController.Mode.ERROR);
|
||||
t.cancel();
|
||||
}
|
||||
}, 500);
|
||||
} else {
|
||||
openEditUsernameDialog(EditUsernameDialogController.Mode.INITIAL);
|
||||
}
|
||||
}
|
||||
|
||||
private void showError() {
|
||||
|
|
|
|||
|
|
@ -45,6 +45,8 @@ public class EditUsernameDialogController implements Initializable {
|
|||
private ButtonPressEvent cancelListener;
|
||||
private UserList userList;
|
||||
|
||||
private final int MAX_LENGTH = 16;
|
||||
|
||||
@FXML
|
||||
private void onConfirm() {
|
||||
setLocked(true);
|
||||
|
|
@ -101,6 +103,10 @@ public class EditUsernameDialogController implements Initializable {
|
|||
public void onUsernameChange(ObservableValue<? extends String> observable, String oldText, String newText) {
|
||||
setFieldError(State.VALID);
|
||||
confirmButton.setDisable(newText.isEmpty());
|
||||
if (textField.getText().length() > MAX_LENGTH) {
|
||||
String s = textField.getText().substring(0, MAX_LENGTH);
|
||||
textField.setText(s);
|
||||
}
|
||||
}
|
||||
|
||||
public void setMode(Mode mode) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue