package application.controller import application.model.MessageListener import application.model.Vessel import application.model.observableMessages import javafx.concurrent.Worker import javafx.fxml.FXML import javafx.fxml.Initializable import javafx.scene.layout.StackPane import map.LeafletMapView import map.MapConfig import map.displayMessageOnMap import java.net.URL import java.util.* import java.util.concurrent.CompletableFuture class MapPanelController : Initializable, MessageListener { @FXML private lateinit var map: StackPane private val mapView = LeafletMapView() override fun initialize(location: URL?, resources: ResourceBundle?) { val completeFutureMap: CompletableFuture = mapView.displayMap(MapConfig()) observableMessages.listeners.add(this) /*completeFutureMap.whenComplete{ workerState, _ -> if (workerState == Worker.State.SUCCEEDED) { } }*/ map.children.add(mapView) } override fun onValueChanged(newValue: MutableMap) { displayMessageOnMap(mapView) } }