Commit e37c9332 authored by edmundszagars's avatar edmundszagars
Browse files

Implementing ErrorBox and checks for file location and selected sorting algorithms

parent 2bccdc3e
package gui;
import javafx.scene.control.Alert;
import javafx.scene.control.Alert.AlertType;
public class ErrorBox {
public ErrorBox(String headerText, String contentText) {
Alert errorAlert = new Alert(AlertType.ERROR);
errorAlert.setHeaderText(headerText);
errorAlert.setContentText(contentText);
errorAlert.showAndWait();
}
}
......@@ -7,6 +7,7 @@ import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.scene.Scene;
import javafx.scene.control.*;
import javafx.scene.control.Alert.AlertType;
import javafx.scene.control.cell.PropertyValueFactory;
import javafx.scene.layout.VBox;
import javafx.stage.FileChooser;
......@@ -26,7 +27,6 @@ public class MainWindow extends Application {
private ArrayList list;
private TableView<Result> table;
private ArrayList<Result> results = new ArrayList<>();
private ArrayList<Sortable> sortables = new ArrayList<>();
@Override
......@@ -104,7 +104,13 @@ public class MainWindow extends Application {
Button startButton = new Button("Run tests");
startButton.setOnAction(event -> {
if(fileLocation.getText().equals("")){
System.out.println("Displaying error box");
new ErrorBox("No file selected!",
"Please select CSV file to run sorting algorithms");
return;
}
if(sortables.isEmpty()){
new ErrorBox("No sort algorithm selected",
"Please select sorting algorithm to execute test");
return;
}
GetDataFromCSV dataFromCSV = new GetDataFromCSV();
......
Markdown is supported
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