Commit 07bf03cd80598b25566ae0f71c157a3232cabae9

Authored by lsagona
1 parent 79b001037b
Exists in master and in 1 other branch dev

add alert message when a non csv file is selected

Showing 2 changed files with 9 additions and 2 deletions Side-by-side Diff

src/main/kotlin/application/controller/MenuBarController.kt View file @ 07bf03c
... ... @@ -7,6 +7,7 @@
7 7 import javafx.event.EventHandler
8 8 import javafx.fxml.FXML
9 9 import javafx.fxml.Initializable
  10 +import javafx.scene.control.Alert
10 11 import javafx.scene.control.CheckMenuItem
11 12 import javafx.scene.control.MenuBar
12 13 import javafx.scene.control.MenuItem
13 14  
... ... @@ -52,10 +53,17 @@
52 53 val window = menuBar.scene.window
53 54 val file = fileChooser.showOpenDialog(window)
54 55 try {
  56 + if (file.extension != "csv") {
  57 + val alert = Alert(Alert.AlertType.WARNING)
  58 + alert.title = "Warning Alert"
  59 + alert.headerText = "Wrong file format."
  60 + alert.contentText = "Please choose à .csv file."
  61 + alert.showAndWait()
  62 + }
55 63 val vessels = createVesselCollection(file)
56 64 observableVessel.vessels.clear()
57 65 observableVessel.vessels = vessels
58   - } catch (ignore: IllegalStateException){
  66 + } catch (ignore: IllegalStateException) {
59 67  
60 68 }
61 69 }
src/main/kotlin/map/MapDisplayer.kt View file @ 07bf03c
... ... @@ -88,7 +88,6 @@
88 88 map.execScript("heatLayer.addLatLng([${message.latitude}, ${message.longitude}]);")
89 89 }
90 90 }
91   -
92 91 }
93 92  
94 93 fun displayHeatMapOnMap(map: LeafletMapView, selectedMMSI: Int) {