移除AuthlibInjectorServersPage的spinner

This commit is contained in:
yushijinhun
2018-06-16 19:21:10 +08:00
parent 22732fee6a
commit ba8cdb1b42
2 changed files with 7 additions and 20 deletions

View File

@@ -36,7 +36,6 @@ public class AuthlibInjectorServersPage extends StackPane implements DecoratorPa
@FXML private JFXDialogLayout confirmServerPane;
@FXML private JFXDialog dialog;
@FXML private StackPane contentPane;
@FXML private JFXSpinner spinner;
@FXML private JFXProgressBar progressBar;
@FXML private JFXButton btnAddNext;
@@ -55,33 +54,22 @@ public class AuthlibInjectorServersPage extends StackPane implements DecoratorPa
txtServerIp.textProperty().addListener((a, b, newValue) ->
btnAddNext.setDisable(!txtServerIp.validate()));
loading();
reload();
}
private void removeServer(AuthlibInjectorServerItem item) {
Settings.INSTANCE.SETTINGS.authlibInjectorServers.remove(item.getInfo());
loading();
reload();
}
private void loading() {
getChildren().remove(contentPane);
spinner.setVisible(true);
private void reload() {
listPane.getChildren().setAll(
Settings.INSTANCE.SETTINGS.authlibInjectorServers.stream()
Settings.INSTANCE.SETTINGS.authlibInjectorServers.stream()
.map(server -> new AuthlibInjectorServerItem(server, this::removeServer))
.collect(toList()));
// TODO: remove spinner
loadingCompleted();
}
private void loadingCompleted() {
getChildren().add(contentPane);
spinner.setVisible(false);
if (Settings.INSTANCE.SETTINGS.authlibInjectorServers.isEmpty())
if (Settings.INSTANCE.SETTINGS.authlibInjectorServers.isEmpty()) {
onAdd();
}
}
@FXML
@@ -135,7 +123,7 @@ public class AuthlibInjectorServersPage extends StackPane implements DecoratorPa
if (!Settings.INSTANCE.SETTINGS.authlibInjectorServers.contains(serverBeingAdded)) {
Settings.INSTANCE.SETTINGS.authlibInjectorServers.add(serverBeingAdded);
}
loading();
reload();
dialog.close();
}

View File

@@ -8,7 +8,6 @@
<fx:root xmlns="http://javafx.com/javafx"
xmlns:fx="http://javafx.com/fxml"
type="StackPane">
<JFXSpinner fx:id="spinner" style="-fx-radius:16" styleClass="materialDesign-purple, first-spinner" />
<StackPane fx:id="contentPane">
<ScrollPane fx:id="scrollPane" fitToWidth="true" fitToHeight="true">
<VBox fx:id="listPane" spacing="10" style="-fx-padding: 20 20 70 20;">