From 80ccb3f549eebc0b78319a9fb9d8fdc3da711804 Mon Sep 17 00:00:00 2001
From: Adrian Stoica <george.a.stoica@ntnu.no>
Date: Thu, 10 Oct 2019 11:22:45 +0200
Subject: [PATCH] added the cell renderer to the list inside
 AbstractFxAppController

---
 .../main/java/simpleex/ui/AbstractFxAppController.java | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/simpleexample2/fxui/src/main/java/simpleex/ui/AbstractFxAppController.java b/simpleexample2/fxui/src/main/java/simpleex/ui/AbstractFxAppController.java
index 6cd2899..dd64168 100644
--- a/simpleexample2/fxui/src/main/java/simpleex/ui/AbstractFxAppController.java
+++ b/simpleexample2/fxui/src/main/java/simpleex/ui/AbstractFxAppController.java
@@ -12,7 +12,9 @@ import javafx.geometry.Point2D;
 import javafx.scene.Node;
 import javafx.scene.control.Alert;
 import javafx.scene.control.Alert.AlertType;
+import javafx.util.Callback;
 import javafx.scene.control.ButtonType;
+import javafx.scene.control.ListCell;
 import javafx.scene.control.ListView;
 import javafx.scene.control.Slider;
 import simpleex.core.LatLong;
@@ -84,6 +86,13 @@ public abstract class AbstractFxAppController {
     // the location list
     locationListView.getSelectionModel().selectedIndexProperty()
       .addListener((prop, oldValue, newValue) -> updateMapMarker(true));
+    //connect the cell renderer to the list
+    locationListView.setCellFactory(new Callback<ListView<LatLong>, ListCell<LatLong>>() {
+		@Override
+		public ListCell<LatLong> call(ListView<LatLong> listView) {
+			return new LatLongCell();
+		}
+	});
   }
 
   private void handleMapDragged(final Node node, final double dx, final double dy) {
@@ -157,6 +166,7 @@ public abstract class AbstractFxAppController {
     if (selectedIndex >= 0 && selectedIndex < latLongs.length) {
       locationListView.getSelectionModel().select(selectedIndex);
     }
+    
   }
 
   private ObjectMapper objectMapper;
-- 
GitLab