Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » NatTable » Updating the structure of a CompositLayer?
Updating the structure of a CompositLayer? [message #1017796] Tue, 12 March 2013 14:57 Go to next message
Alex Kipling is currently offline Alex KiplingFriend
Messages: 258
Registered: July 2012
Senior Member
I am changing the number of a Rows in a Layer, which wraped in a CompositeLayer.

After the change I would like to update the layout of the CompositeLayer, and the wrapped Layer.

How would I do that?


I tried:

layerCompositeAll.layerNewObjectsTop.handleLayerEvent(new RowStructuralRefreshEvent(
		layerCompositeAll) {

});
layerCompositeAll.handleLayerEvent(new RowStructuralRefreshEvent(layerCompositeAll) {

});

layerCompositeAll.layerNewObjectsTop.doCommand(new StructuralRefreshCommand());
layerCompositeAll.doCommand(new StructuralRefreshCommand());
natTable.doCommand(new StructuralRefreshCommand());
layerCompositeAll.doCommand(new StructuralRefreshCommand());
layerCompositeAll.layerNewObjectsTop.doCommand(new StructuralRefreshCommand());

natTable.redraw();
natTable.refresh();


The refresh is only done, when I resize a column / a row in the table.
Re: Updating the structure of a CompositLayer? [message #1017809 is a reply to message #1017796] Tue, 12 March 2013 15:16 Go to previous messageGo to next message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 1434
Registered: July 2012
Senior Member
If I saw it right in your various posts about that stuff, you replaced the DataLayer with your custom CompositeLayer. Is that correct?

If you are doing that extended stuff, you should be aware of the architecture and how things work. In the documentation you will find how commands and events are used in NatTable:
http://eclipse.org/nattable/documentation.php?page=basics

There you can see that commands go down the layer stack until some handler will catch it, execute it and possibly fire a event to notify about command execution. The StructuralRefreshCommand gets processed by the StructuralRefreshCommandHandler which is registered in the DataLayer. So it seems the commands you are trying to execute are never handled.
Re: Updating the structure of a CompositLayer? [message #1017834 is a reply to message #1017809] Tue, 12 March 2013 16:08 Go to previous messageGo to next message
Alex Kipling is currently offline Alex KiplingFriend
Messages: 258
Registered: July 2012
Senior Member
Thnx Dirk, this is correct - I replaced the DataLayer by a CompositeLayer.
But it does not have to be a StructuralRefreshCommandHandler.
I am interested in the update mechanism, which is triggered, when I do a manual column resize.

Because the manual resize - updates the CompositeLayer layout correctly.
Re: Updating the structure of a CompositLayer? [message #1017842 is a reply to message #1017834] Tue, 12 March 2013 16:15 Go to previous messageGo to next message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 1434
Registered: July 2012
Senior Member
You are trying to do a
doCommand(new StructuralRefreshCommand());


and this command is ONLY handled by StructuralRefreshCommandHandler

If you do a resize according refresh events will get fired, e.g. ColumnResizeEvent. So this is another refresh.
Re: Updating the structure of a CompositLayer? [message #1017844 is a reply to message #1017842] Tue, 12 March 2013 16:16 Go to previous messageGo to next message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 1434
Registered: July 2012
Senior Member
Oh, and really, doing such advanced stuff you should try to read and understand the source code! Everything you are searching at the moment can be found in DataLayer
Re: Updating the structure of a CompositLayer? [message #1017879 is a reply to message #1017844] Tue, 12 March 2013 17:34 Go to previous message
Alex Kipling is currently offline Alex KiplingFriend
Messages: 258
Registered: July 2012
Senior Member
Thnx four your responce Dirk.
This is somehow my fault, because I tried sending the Events at my lowest layer too and it did not work:
                    layerCompositeAll.layerNewObjectsTop.fireLayerEvent(new StructuralRefreshEvent(
                            layerCompositeAll.layerNewObjectsTop));
                    layerCompositeAll.layerExistingObjectsSecond.fireLayerEvent(new StructuralRefreshEvent(
                            layerCompositeAll.layerExistingObjectsSecond));
                    layerCompositeAll.fireLayerEvent(new StructuralRefreshEvent(layerCompositeAll));
                    layerCompositeAll.layerNewObjectsTop.fireLayerEvent(new StructuralRefreshEvent(
                            layerCompositeAll.layerNewObjectsTop));
                    layerCompositeAll.layerExistingObjectsSecond.fireLayerEvent(new StructuralRefreshEvent(
                            layerCompositeAll.layerExistingObjectsSecond));


Of course I am reading the sourcecode, but especially here the mechanism of layout refreshing is intransparent for me:
- the StructuralRefreshCommandHandler does nothing but sending a StructuralRefreshEvent (it did not work)
- repainting the whole table dos not work (cache?)
- Resizing triggers : RecalculateScrollBarsCommand, ColumnResizeCommand (doesn't start a structural update for me)

So all I wanted to ask you about differences of resizing the table and triggering a manual Command / Event
Previous Topic:Regions in Natable?
Next Topic:How to do full row selection?
Goto Forum:
  


Current Time: Sun Dec 21 12:49:55 GMT 2014

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

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