java - JavaFx CheckTreeView how to check which item is unchecked? -
i using controlsfx checktreeview. have lots of elements in checktreeview , dont want traverse through elements in tree ( because takes lots of time due number of elements in tree). there method checktreeview.getlastuncheckeditem();
last unchecked one.
currently checking number of elements checked , comparing counter.
if (countprev > count){ //something unchecked stuff }
but again, cant find unchecked without traverse through elements.
edit:
when user checks item on checktreeview, item
string lastcheckeditem = checktreeview.getcheckmodel(). getcheckeditems().get(treeview.getcheckmodel().getcheckeditems().size()-1).tostring();
now need unchecked item
stack<yourclassofthecheckmodel> recentlyunchcked = new stack<yourclassofthecheckmodel>(); yourtreeview.getselectionmodel(). selecteditemproperty().addlistener( new changelistener() { @override public void changed(observablevalue observable, object oldvalue, object newvalue) { treeitem<yourclassofthecheckmodel> selecteditem = (treeitem<yourclassofthecheckmodel>) newvalue; checkmodel checkmodel = checktreeview.getcheckmodel(). bool checked = checkmodel.ischecked (selecteditem); if(checked==false){ recentlyunchcked.push(yourobjectofthecheckmodel); } } });
hope or give idea though don't know if work (code not tested, have no ide right now).
Comments
Post a Comment