Skip to main content



      Home
Home » Eclipse Projects » NatTable » No selection without CompositeLayer?
No selection without CompositeLayer? [message #1046733] Mon, 22 April 2013 05:42 Go to next message
Eclipse UserFriend
Hi,

there seems to be an unexpected difference between

...
ViewportLayer viewportLayer = new ViewportLayer(treeLayer);
natTable = new NatTable(parent, viewportLayer , false);
...


and

...
ViewportLayer viewportLayer = new ViewportLayer(treeLayer);
CompositeLayer compositeLayer = new CompositeLayer(1, 1);
compositeLayer.setChildLayer(GridRegion.BODY, viewportLayer, 0, 0);
natTable = new NatTable(parent, natLayer, false);
...


To my surprise only the version with the composite layer results in a table that reacts on mouseclicks (selection and editing). Why is that? am I missing some important point?

As far as I understand the com[posite layer it is only responsible for composing a table from different layers. Right?

There is some
compositeLayer.registerCommandHandler(new EditCellCommandHandler());
compositeLayer.registerEventHandler(new InlineCellEditEventHandler(compositeLayer));

but if I apply all this to the viewportlayer it does not make a difference.

Thanks for your help.

J
Re: No selection without CompositeLayer? [message #1046744 is a reply to message #1046733] Mon, 22 April 2013 06:01 Go to previous messageGo to next message
Eclipse UserFriend
The difference is this:

Quote:
compositeLayer.setChildLayer(GridRegion.BODY, viewportLayer, 0, 0);


which adds the GridRegion.BODY region label which gets interpreted by handlers etc.
Re: No selection without CompositeLayer? [message #1046768 is a reply to message #1046744] Mon, 22 April 2013 06:44 Go to previous messageGo to next message
Eclipse UserFriend
To be more precise, in the DefaultEditBindings the mouse action bindings are registered against the GridRegion.BODY label. You need to adjust this to make the bindings work.
Re: No selection without CompositeLayer? [message #1046777 is a reply to message #1046768] Mon, 22 April 2013 06:57 Go to previous messageGo to next message
Eclipse UserFriend
In other words the DefaultEditBindings expect the cells to be labelled as GridRegion.BODY which could be achieved by a) adding this label manually or b) customizing the bindings? I understand that. But in the case described above there was no way to select a cell nor to expand/collapse a tree node. The selection related code was the same in both cases.
Re: No selection without CompositeLayer? [message #1046781 is a reply to message #1046777] Mon, 22 April 2013 07:03 Go to previous messageGo to next message
Eclipse UserFriend
The same applies for the selection. Have a look at the DefaultSelectionBindings.

We work around that issue usually by applying the region label to the ViewportLayer like this

viewportLayer.setRegionName(GridRegion.BODY);


We will look at this in our future architecture. But for now this should solve your issues.
Re: No selection without CompositeLayer? [message #1046787 is a reply to message #1046781] Mon, 22 April 2013 07:12 Go to previous message
Eclipse UserFriend
Yes it does. Thank you for clarifying this.
Previous Topic:Problem in PercentageSizingExample
Next Topic:Viewport merge - testers needed!
Goto Forum:
  


Current Time: Thu Jul 24 20:59:44 EDT 2025

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

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

Back to the top