So I have a listview that displays a label on a callback that checks a list if that particular item is disabled, and adjusts it display string and appearance occordingly, however, it does not update unless the form is reloaded or I scroll down and back up.
Is there a call I need to make to ensure the cell is repainted after I make a change? I have caching disabled on the listview already, doesn't seem to make a difference. This is my callback:
Code:
...
lv.setCellFactory(new Callback<ListView<String>, ListCell<String>>() {
@Override
public ListCell<String> call(ListView<String> list) {
return new LabelCell();
}
});
...
static class LabelCell extends ListCell<String> {
@Override
public void updateItem(String item, boolean empty) {
super.updateItem(item, empty);
if (item != null) {
String s = item;
Label l;
if (disabledMods.contains(item)) {
s = "DISABLED " + s;
l = new Label(s);
l.disableProperty().setValue(Boolean.TRUE);
} else {
l = new Label(item);
l.disableProperty().setValue(Boolean.FALSE);
}
setGraphic(l);
}
}
}