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");
|
Log.v(this.getClass().getSimpleName(), "Login shown");
|
||||||
mainContainer.setVisible(false);
|
mainContainer.setVisible(false);
|
||||||
loadingController.hide();
|
loadingController.hide();
|
||||||
|
if (isError) {
|
||||||
Timer t = new Timer();
|
Timer t = new Timer();
|
||||||
t.schedule(new TimerTask() {
|
t.schedule(new TimerTask() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
openEditUsernameDialog(isError ? EditUsernameDialogController.Mode.ERROR : EditUsernameDialogController.Mode.INITIAL);
|
openEditUsernameDialog(EditUsernameDialogController.Mode.ERROR);
|
||||||
t.cancel();
|
t.cancel();
|
||||||
}
|
}
|
||||||
}, 500);
|
}, 500);
|
||||||
|
} else {
|
||||||
|
openEditUsernameDialog(EditUsernameDialogController.Mode.INITIAL);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void showError() {
|
private void showError() {
|
||||||
|
|
|
||||||
|
|
@ -45,6 +45,8 @@ public class EditUsernameDialogController implements Initializable {
|
||||||
private ButtonPressEvent cancelListener;
|
private ButtonPressEvent cancelListener;
|
||||||
private UserList userList;
|
private UserList userList;
|
||||||
|
|
||||||
|
private final int MAX_LENGTH = 16;
|
||||||
|
|
||||||
@FXML
|
@FXML
|
||||||
private void onConfirm() {
|
private void onConfirm() {
|
||||||
setLocked(true);
|
setLocked(true);
|
||||||
|
|
@ -101,6 +103,10 @@ public class EditUsernameDialogController implements Initializable {
|
||||||
public void onUsernameChange(ObservableValue<? extends String> observable, String oldText, String newText) {
|
public void onUsernameChange(ObservableValue<? extends String> observable, String oldText, String newText) {
|
||||||
setFieldError(State.VALID);
|
setFieldError(State.VALID);
|
||||||
confirmButton.setDisable(newText.isEmpty());
|
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) {
|
public void setMode(Mode mode) {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue