| TreeNatTableExample - single selection on expand/collapse image doesn't work [message #901060] |
Thu, 09 August 2012 11:01  |
Clara Miller Messages: 1 Registered: August 2012 |
Junior Member |
|
|
Dear Dirk,
thank you for the good examples and explanations of NatTable usage. I'm interested in using your TreeNatTableExample.
As of one point the sample is perfect:
Currently the tree expands/collapses when a double click is made onto the row. But a single click on the expand/collapse image doesn't work in your example and I can't find the problem, why. The samples at NatTable are using a different approach than you and this point works fine.
Do you know how to correct this erroneous behavior?
Thanks!
|
|
|
| Re: TreeNatTableExample - single selection on expand/collapse image doesn't work [message #901157 is a reply to message #901060] |
Fri, 10 August 2012 03:17   |
Dirk Fauth Messages: 524 Registered: July 2012 |
Senior Member |
|
|
Hi,
it took me a moment to figure out which example in the NatTable examples you mean. But ok, you are talking about my article in the eclipse magazine this year. 
You are right that I missed a configuration for enabling single click expand/collapse there.
You should add the DefaultTreeLayerConfiguration to your NatTable like this
natTable.addConfiguration(new DefaultTreeLayerConfiguration(treeLayer.getModel()));
which will add the needed configurations.
Alternatively you could add the needed UiBindings in your custom configurations yourself like this
public void configureUiBindings(UiBindingRegistry uiBindingRegistry) {
uiBindingRegistry.registerFirstDoubleClickBinding(
MouseEventMatcher.bodyLeftClick(SWT.NONE),
new TreeExpandCollapseAction()
);
uiBindingRegistry.registerFirstSingleClickBinding(
new CellPainterMouseEventMatcher(GridRegion.BODY, MouseEventMatcher.LEFT_BUTTON, treeImagePainter),
new TreeExpandCollapseAction()
);
}
But I would suggest to use the DefaultTreeLayerConfiguration.
Hope this helps.
Greez,
Dirk
[Updated on: Fri, 10 August 2012 03:20] Report message to a moderator
|
|
|
|
|
|
|
| Re: TreeNatTableExample - single selection on expand/collapse image doesn't work [message #913026 is a reply to message #910657] |
Fri, 14 September 2012 12:16  |
Tom Hochstein Messages: 12 Registered: July 2009 |
Junior Member |
|
|
Single click selection (i.e., not expand/collapse) in the tree examples is not working either. Please note that at first I thought this was intermittent, but then I noticed that single click-drag works just fine. This means that if you don't keep your mouse perfectly still while clicking, it will look like it is working.
This doesn't appear to be the same problem as for tree expand/collapse. I modified UIBindingRegistry.getMouseEventAction() again as I described below, but this time I didn't see that one mouse action was hiding the other.
Tom
|
|
|
Powered by
FUDForum. Page generated in 0.02159 seconds