Home » Eclipse Projects » Remote Application Platform (RAP) » Tree collapse selection change not firing Selection listener
| |
Re: Tree collapse selection change not firing Selection listener [message #1449746 is a reply to message #1449262] |
Tue, 21 October 2014 19:50 |
Chris Fairhall Messages: 221 Registered: February 2011 |
Senior Member |
|
|
Version 2.3.1
I can reproduce it in 3.0.0-M2
public class BasicEntryPoint extends AbstractEntryPoint {
@Override
protected void createContents(Composite parent) {
final Tree tree = new Tree(parent, SWT.BORDER);
TreeItem item1 = new TreeItem(tree, SWT.NONE);
item1.setText("Item 1");
TreeItem item2 = new TreeItem(item1, SWT.NONE);
item2.setText("Item 2");
tree.addListener(SWT.Selection, new Listener() {
public void handleEvent(Event event) {
System.out.println("Selection event " + event.item);
}
});
tree.setLayoutData(new GridData(150, 150));
Button button = new Button(parent, SWT.PUSH);
button.setText("Print Selection");
button.addListener(SWT.Selection, new Listener() {
public void handleEvent(Event event) {
System.out.println("Tree selection: " + Arrays.toString(tree.getSelection()));
}
});
}
}
I would expect when Item 2 is selected and the collapse icon for Item 1 is clicked, resulting in the visible selection of Item 1, a selection event would be fired.
Request when clicking collapse icon:
{"head":{"requestCounter":4},"operations":[["set","w3",{"focusItem":"w6"}],["set","w6",{"expanded":false}],["notify","w3","Collapse",{"item":"w6"}],["set","w1",{"cursorLocation":[13,22]}]]}
Request when clicking Item 1:
{"head":{"requestCounter":5},"operations":[["set","w3",{"selection":["w6"]}],["notify","w3","Selection",{"item":"w6","button":1,"shiftKey":false,"ctrlKey":false,"altKey":false}],["set","w3",{"focusItem":"w6"}],["set","w1",{"cursorLocation":[41,22]}]]}
w3 = Tree widget
w6 = Item 1
w7 = Item 2
The server side does return the correct selection when you call Tree#getSelection()
I think either the JS client needs to include a ["set","w3",{"selection":["w6"]}] and a notify Selection or the server-side needs to fire the selection event when it changes the selection with the set "focusItem".
|
|
|
Goto Forum:
Current Time: Fri Apr 26 03:41:27 GMT 2024
Powered by FUDForum. Page generated in 0.04503 seconds
|