Commit 71731362 authored by Luna Riegel's avatar Luna Riegel
Browse files

Feat: Add IndeterminateSpinnerDialog

Adds a generalized version of the 3D-Renderer LoadingDialog to improve
UX by showing that CityDoctor is currently busy doing something in the
background of indeterminate length, e.g. opening a file or waiting for
the Schematron thread to finish.
parent f9d11bb3
package de.hft.stuttgart.citydoctor2.gui;
import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;
import javafx.scene.Scene;
import javafx.scene.control.Label;
import javafx.scene.layout.VBox;
import javafx.stage.Modality;
import javafx.stage.Stage;
import javafx.stage.StageStyle;
import javafx.stage.Window;
import java.io.IOException;
public class IndeterminateSpinnerDialog {
private Stage stage;
@FXML
private Label messageLbl;
public IndeterminateSpinnerDialog(Window parent, String message) throws IOException {
FXMLLoader loader = new FXMLLoader(LoadingInfoDialog.class.getResource("IndeterminateSpinnerDialog.fxml"));
loader.setController(this);
VBox box = loader.load();
stage = new Stage(StageStyle.UNDECORATED);
Scene scene = new Scene(box);
scene.setFill(null);
stage.setScene(scene);
stage.initOwner(parent);
stage.initModality(Modality.APPLICATION_MODAL);
messageLbl.setText(message);
}
public void changeMessage(String message){
messageLbl.setText(message);
}
public void show() {
stage.show();
}
public void hide() {
stage.hide();
}
}
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.geometry.Insets?>
<?import javafx.scene.control.Label?>
<?import javafx.scene.control.ProgressIndicator?>
<?import javafx.scene.layout.VBox?>
<?import javafx.scene.text.Font?>
<VBox alignment="CENTER" maxHeight="-Infinity" maxWidth="-Infinity" spacing="10.0" xmlns="http://javafx.com/javafx/22" xmlns:fx="http://javafx.com/fxml/1">
<children>
<Label fx:id="messageLbl" text="Message">
<font>
<Font size="14.0" />
</font>
</Label>
<ProgressIndicator />
</children>
<padding>
<Insets bottom="20.0" left="20.0" right="20.0" top="20.0" />
</padding>
</VBox>
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment