View Single Post
Old 12-28-2012, 09:36 PM   PM User | #1
rich1051414
New to the CF scene

 
Join Date: Dec 2012
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
rich1051414 is an unknown quantity at this point
[Resolved]Odd JavaFX problem

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);
            }
        }
    }

Last edited by rich1051414; 12-28-2012 at 10:40 PM..
rich1051414 is offline   Reply With Quote