I seem to have found a problem, possibly created by me, not sure but it involves removing items from a listbox.
if( selectionRef.update() ) {
// Selection has changed
if (selectionRef.get().isEmpty()) {
//Load defaults here.
LOG.info("Selection ref is NULL");
} else {
int selectedIndex = listActiveCrowds.getSelectionModel().getSelection();
LOG.info("Crowd [{}]", selectedIndex);
Crowd crowd = getState(CrowdManagerAppstate.class).getCrowdManager().getCrowd(selectedIndex);
for (int i = 0; i < 8; i++) {
ObstacleAvoidanceParams oap = crowd.getObstacleAvoidanceParams(i);
//Remove selected parameter.
remove(listBoxAvoidance, i);
//Insert the new parameters into the list.
insert(listBoxAvoidance, i, OavParamToString(oap, i));
}
listBoxAvoidance.getSelectionModel().setSelection(0);
System.out.println("Update Loop-Visually Selected = " + listActiveCrowds.getSelectionModel().getSelection());
}
}
What is going on is I have 2 listBoxes. listActiveCrowds can have objects added to it or removed from it. Whenever a selection changes in listActiveCrowds, it should update the parameters in listBoxAvoidance with whatever it pulls in from the crowdManager.
Everything updates as expected when clicking an item in listActiveCrowds or if I remove the last item added to the list when there are others above it.
If I remove an item from any place other than the last added, the versioned reference never fires, null or otherwise.
For example,
3 items in list, (0-2), removal by starting from last item in list.
Crowd [2]
Update Loop-Visually Selected = 2
removing selection = 2
Crowd [1]
Update Loop-Visually Selected = 1
removing selection = 1
Crowd [0]
Update Loop-Visually Selected = 0
removing selection = 0
Selection ref is NULL, loading defaults.
Removal by starting at first item in list. Selecting the item always works, otherwise not so.
Crowd [0]
Update Loop-Visually Selected = 0
removing selection = 0
removing selection = 0
removing selection = 0
Selection ref is NULL, loading defaults