package cz.vutbr.feec.gui;

import java.io.IOException;

import cz.vutbr.feec.libraryClasses.GuiMethods;
import cz.vutbr.feec.project.GlobalParameters;

import javafx.application.Application;
import javafx.concurrent.Task;
import javafx.event.EventHandler;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.stage.Stage;
import javafx.stage.WindowEvent;

public class MainInitializeGui extends Application {

	private static Stage initializeStage;
	@Override
	public void start(final Stage primaryStage) throws IOException {
		// vytvaram uvodne gui s inputom pre sirku a dlzku
		//Parent root = null;
		Parent root = FXMLLoader.load(getClass().getResource("InitializeGui.fxml"));
		/*try {
			root = FXMLLoader
					.load(getClass().getResource("InitializeGui.fxml"));
		} catch (IOException e) {
			e.printStackTrace();
		}
		*/
		primaryStage.setScene(new Scene(root));
		primaryStage.setTitle("Untitled");
		GlobalParameters.primaryStage = primaryStage;
		primaryStage.show();
		primaryStage.setOnCloseRequest(new EventHandler<WindowEvent>() {
			public void handle(WindowEvent we) {
				System.out.println("Stage is closing");

				if (!GuiMethods.windowClosedClicked(primaryStage))
					we.consume();
			}
		});
	}

	public static void main(String[] args) {
		launch(args);
	}
}
