mirror of
https://github.com/HMCL-dev/HMCL.git
synced 2025-09-15 06:45:42 -04:00
Notice user to add authentication server
This commit is contained in:
parent
64e7cc74b2
commit
f2f0c96e62
@ -20,6 +20,7 @@ package org.jackhuang.hmcl.ui.account;
|
|||||||
import com.jfoenix.concurrency.JFXUtilities;
|
import com.jfoenix.concurrency.JFXUtilities;
|
||||||
import com.jfoenix.controls.*;
|
import com.jfoenix.controls.*;
|
||||||
|
|
||||||
|
import javafx.beans.InvalidationListener;
|
||||||
import javafx.beans.binding.Bindings;
|
import javafx.beans.binding.Bindings;
|
||||||
import javafx.beans.property.ReadOnlyObjectProperty;
|
import javafx.beans.property.ReadOnlyObjectProperty;
|
||||||
import javafx.fxml.FXML;
|
import javafx.fxml.FXML;
|
||||||
@ -90,6 +91,9 @@ public class AddAccountPane extends StackPane {
|
|||||||
cboType.setConverter(stringConverter(Accounts::getAccountTypeName));
|
cboType.setConverter(stringConverter(Accounts::getAccountTypeName));
|
||||||
cboType.getSelectionModel().select(0);
|
cboType.getSelectionModel().select(0);
|
||||||
|
|
||||||
|
cboServers.getItems().addListener(onInvalidating(this::checkIfNoServer));
|
||||||
|
checkIfNoServer();
|
||||||
|
|
||||||
ReadOnlyObjectProperty<AccountFactory<?>> loginType = cboType.getSelectionModel().selectedItemProperty();
|
ReadOnlyObjectProperty<AccountFactory<?>> loginType = cboType.getSelectionModel().selectedItemProperty();
|
||||||
|
|
||||||
txtPassword.visibleProperty().bind(loginType.isNotEqualTo(Accounts.FACTORY_OFFLINE));
|
txtPassword.visibleProperty().bind(loginType.isNotEqualTo(Accounts.FACTORY_OFFLINE));
|
||||||
@ -122,6 +126,13 @@ public class AddAccountPane extends StackPane {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void checkIfNoServer() {
|
||||||
|
if (cboServers.getItems().isEmpty())
|
||||||
|
cboServers.getStyleClass().setAll("jfx-combo-box-warning");
|
||||||
|
else
|
||||||
|
cboServers.getStyleClass().setAll("jfx-combo-box");
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the additional data that needs to be passed into {@link AccountFactory#create(CharacterSelector, String, String, Object)}.
|
* Gets the additional data that needs to be passed into {@link AccountFactory#create(CharacterSelector, String, String, Object)}.
|
||||||
*/
|
*/
|
||||||
|
@ -1007,6 +1007,15 @@
|
|||||||
-jfx-focus-color: -fx-base-check-color;
|
-jfx-focus-color: -fx-base-check-color;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.jfx-combo-box-warning {
|
||||||
|
-jfx-focus-color: #D34336;
|
||||||
|
-jfx-unfocus-color: #D34336;
|
||||||
|
}
|
||||||
|
|
||||||
|
.jfx-combo-box-warning .text {
|
||||||
|
-fx-fill: #D34336;
|
||||||
|
}
|
||||||
|
|
||||||
.combo-box-popup .list-view .jfx-list-cell .label,
|
.combo-box-popup .list-view .jfx-list-cell .label,
|
||||||
.combo-box-popup .list-view .jfx-list-cell:filled:hover .label {
|
.combo-box-popup .list-view .jfx-list-cell:filled:hover .label {
|
||||||
-fx-text-fill: BLACK;
|
-fx-text-fill: BLACK;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user