CheckBoxTreeviewer set old checked element on creating new set of objects

我怕爱的太早我们不能终老 提交于 2019-12-12 02:33:37

问题


I have used CheckboxTreeviewer with ICheckStateListener to get a checked elements. if element get checked then create a new set of object and setInut in same CheckboxTreeviewer.but when I put the new set of object in CheckboxTreeviewer previously checked elements unchecked.

code -

  chboxtv.addCheckStateListener(new ICheckStateListener() {

    @Override
    public void checkStateChanged(CheckStateChangedEvent event) {
        String child=null;
        String parent=null;
        Object obj= event.getElement();
        if(obj instanceof Children){              
            Children child=(Children)changed;                    
            childvalue=child.getChildren();
            rootvalue=child.getParent();
            List<Parent>  pList=getResult(rootvalue,childvalue);
            //Getting previously checked element.
           Object [] chek=  chboxtv.getCheckedElements();                                                  chboxtv.setInput(pList);                                
               chboxtv.expandToLevel(3);
               chboxtv.setCheckedElements(chek);
        }                
    }
});

In my condition always presents previously checked elements value in new set of object.

How to checked previously checked elements when new set of object load in CheckboxTreeviewer.

please see the Answer of this question

CheckboxTreeviewer previously set checked elements after reload

but still my problem is not solve. I am wasting two days on it.

How to achieve this?

来源:https://stackoverflow.com/questions/41267253/checkboxtreeviewer-set-old-checked-element-on-creating-new-set-of-objects

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!