package at.fos.ermodel.gui;

import javafx.geometry.Insets;
import javafx.geometry.Pos;
import javafx.scene.Scene;
import javafx.scene.control.Label;
import javafx.scene.control.ProgressBar;
import javafx.scene.layout.Background;
import javafx.scene.layout.BackgroundFill;
import javafx.scene.layout.CornerRadii;
import javafx.scene.layout.VBox;
import javafx.stage.Stage;


public class V1
        extends Stage {
    public static V1 thisActionMessageDialog;
    private final Label showFilename;
    private Thread th;

    public V1(B3 siteCommanderFrame) {
        thisActionMessageDialog = this;
        setTitle("Generate/Save SQL-Script");


        getIcons().add(C2.applicationImageIconAsICO);
        ProgressBar progress = new ProgressBar();
        progress.setPrefWidth(200.0D);
        progress.setProgress(-1.0D);
        VBox root = new VBox();
        progress.setBackground(new Background(new BackgroundFill(C2.ButtonBackgroundColor, CornerRadii.EMPTY, Insets.EMPTY)));
        this.showFilename = new Label("");
        this.showFilename.setAlignment(Pos.CENTER);

        Scene scene = new Scene(root, 200.0D, 40.0D);
        root.getChildren().add(progress);
        root.getChildren().add(this.showFilename);
        setScene(scene);

        if (siteCommanderFrame != null) {
            initOwner(siteCommanderFrame);
        }


        sizeToScene();
        setResizable(false);
    }


    private void startTimer() {
        this.th.setDaemon(true);
        this.th.start();
    }


    public void setThread(Thread th) {
        this.th = th;
        startTimer();
        showAndWait();
    }


    public Label getShowFilename() {
        return this.showFilename;
    }
}


