| Summary: | [Tree] Selection Problem | ||||||
|---|---|---|---|---|---|---|---|
| Product: | [RT] RAP | Reporter: | Setya Nugdjaja <jsetya> | ||||
| Component: | RWT | Assignee: | Benjamin Muskalla <b.muskalla> | ||||
| Status: | RESOLVED FIXED | QA Contact: | |||||
| Severity: | normal | ||||||
| Priority: | P3 | CC: | jsetya | ||||
| Version: | 1.0 | ||||||
| Target Milestone: | 1.2 M6 | ||||||
| Hardware: | PC | ||||||
| OS: | All | ||||||
| Whiteboard: | |||||||
| Attachments: |
|
||||||
Created attachment 99883 [details]
Screenshot of tree selection
Just tested this with qooxdoo 0.7.3 and the problem persists. Just the steps need to be adjusted a little bit: * Open view * Select Parent * Click + of parent * Click Child => Both are selected Cannot reproduce with latest CVS. Please reopen if the problem still persist. (In reply to comment #3) > Cannot reproduce with latest CVS. Please reopen if the problem still persist. > I can confirm that this bug has been fixed. Thanks & Regards, Setya |
Hi, When navigating through tree nodes, the selection on parent node won't be removed when its children are selected. Here's the snippet : public void createPartControl(Composite parent) { treeViewer = new TreeViewer(parent,SWT.VIRTUAL); treeViewer.setUseHashlookup(true); java.util.List<Map<String,Object>> list = new Vector<Map<String, Object>>(1); Map<String,Object> parentNode = new HashMap<String, Object>(3); parentNode.put("id", "parentNode"); parentNode.put("caption", "Parent"); Map<String,Object> childNode = new HashMap<String, Object>(3); childNode.put("id", "childNode"); childNode.put("caption", "Child"); Map<String,String> grandChildNode = new HashMap<String, String>(2); grandChildNode.put("id", "grandChildNode"); grandChildNode.put("caption", "GrandChild"); parentNode.put("descendant", childNode); childNode.put("descendant", grandChildNode); list.add(parentNode); treeViewer.setContentProvider(getTreeContentProvider()); treeViewer.setLabelProvider(getTreeLabelProvider()); ((Tree)treeViewer.getControl()).setItemCount(list.size()); treeViewer.setInput(list); } private IContentProvider getTreeContentProvider() { return new ILazyTreeContentProvider() { private TreeViewer treeViewer = null; public Object getParent(Object element){return null;} public void dispose(){} @Override public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { treeViewer = newInput != null ? (TreeViewer)viewer : null; } @Override @SuppressWarnings("unchecked") public void updateChildCount(Object element, int currentChildCount) { if (!(element instanceof List)) return; if (((List)element).size() == currentChildCount) return; treeViewer.setChildCount(element,((List)element).size()); } @Override @SuppressWarnings("unchecked") public void updateElement(Object parent, int index) { if (parent instanceof List) { List list = (List)parent; Map map = (Map)list.get(index); treeViewer.replace(parent, index, map); treeViewer.setChildCount(map,1); } else { Map map = (Map)parent; Map descendant = (Map)map.get("descendant"); if (descendant != null) { treeViewer.replace(parent, index, descendant); treeViewer.setChildCount(descendant, descendant.get("descendant") == null ? 0 : 1); } } } }; } @SuppressWarnings("unchecked") private IBaseLabelProvider getTreeLabelProvider() { return new LabelProvider() { @Override public String getText(Object element) { return (String)((Map)element).get("caption"); } }; } ... Step to reproduce : 1. Open the view. 2. Click on the + sign of 'Parent' node, the parent node is expanded & selected. 3. Click on the + sign of 'Child' node, the child node is expanded & selected, but the selection on parent node persists. 4. Click on the GrandChild node and the selection on Parent & Child node persists. Thanks & Regards, Setya