Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Remote Application Platform (RAP) » Tree collapse selection change not firing Selection listener
Tree collapse selection change not firing Selection listener [message #1449211] Tue, 21 October 2014 03:20 Go to next message
Chris Fairhall is currently offline Chris FairhallFriend
Messages: 221
Registered: February 2011
Senior Member
I've got a Tree widget with a SelectionListener added.

Selection events work fine when navigating via keyboard arrows is mouse clicks.

However, clicking the collapse icon on a parent node of a selected node changes the visual selection to the parent but no selection event is fired.

Is this normal behaviour?

Also, there is a section about four pixels between the node text and node image where clicking will not select the node.
Re: Tree collapse selection change not firing Selection listener [message #1449262 is a reply to message #1449211] Tue, 21 October 2014 05:20 Go to previous messageGo to next message
Ivan Furnadjiev is currently offline Ivan FurnadjievFriend
Messages: 2426
Registered: July 2009
Location: Sofia, Bulgaria
Senior Member
Hi,
which RAP version are you using? Is it reproducible with RAP 3.0M2?
Best,
Ivan

--
Ivan Furnadjiev

Twitter: @EclipseRAP
Blog: http://eclipsesource.com/blogs/

Professional services for RAP and RCP?
http://eclipsesource.com/services/rap/
Re: Tree collapse selection change not firing Selection listener [message #1449746 is a reply to message #1449262] Tue, 21 October 2014 19:50 Go to previous message
Chris Fairhall is currently offline Chris FairhallFriend
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".
Previous Topic:Native browser scrolling without Scrolling Composites in RAP
Next Topic:RAP E4 RWT Theming
Goto Forum:
  


Current Time: Thu Apr 25 20:48:30 GMT 2024

Powered by FUDForum. Page generated in 0.02626 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top