Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » NatTable » Column resize redraw ignored (v 1.1.1)(NatTable is not honouring column resizes)
Column resize redraw ignored (v 1.1.1) [message #1497895] Thu, 04 December 2014 03:52 Go to next message
Dave Meibusch is currently offline Dave MeibuschFriend
Messages: 7
Registered: March 2010
Junior Member
We've just upgraded from NatTable 1.0 to 1.1.1 and are experiencing intermittent issues with column resizing.
The table will work perfectly (drag resizing columns, auto-resizing columns) for a period of time - then stop resizing. Once a table is in this state, the columns can not be resized.

We have not been able to exactly reproduce the circumstances that "switch" the table into this state. We have no programmatic resizing of the columns. and the data in the table is static (not changing). The columns are not using percentages.

Debugging when a table is in this state, we can see the MultiColumnResizeCommand being processed with (correct) new column widths. Calls to DataLayer.setColumnWidthByPosition() look correct. ColumnResizeEvent events are fired. The VisualChangeEventConflator runs natTable.updateResize() in an asyncExec which will redraw() the table. However the table is redrawn unchanged. After the ColumnResizeEvent the sizeMap in the SizeConfig does contain the (correct) new column widths - however this is not how the table has been subsequently rendered.

I'll keep trying to debug the issue. Any suggestions or ideas on where to look next?

thanks,
Dave Meibusch
Re: Column resize redraw ignored (v 1.1.1) [message #1497956 is a reply to message #1497895] Thu, 04 December 2014 04:52 Go to previous messageGo to next message
Dave Meibusch is currently offline Dave MeibuschFriend
Messages: 7
Registered: March 2010
Junior Member
Further clarification (after more debugging).
The table will either work perfectly (resizing) or not after being created.

When debugging, it is apparent that the difference between a working resizable table and one that is not working is the DataLayer.setColumnWidthByPosition() that is called.
The ColumnResizeCommand is routed in GlazedListsTableLayer (our underlying layer) only to the first child layer that responds true to the command. If this child layer is the DataLayer, the resize will work. However, if the child layer is the FilterRowDataLayer (we have a filter row at the top of our table), then the resize is ignored. The child layers are in CompositeLayer.childLayerToLayoutCoordinateMap, which is a HashMap. Hence, when looping through the child layers on each incarnation of the table, the order of the children is based on the vagaries of hashing. Hence, sometimes the resize works and sometimes it doesn't.

I'm a little unsure how to resolve this.
Should the FilterRowDataLayer not handle ColumnResizeCommands (unregisterCommandHandler)? Or should we be explicitly handling ColumnResizeCommands in another layer?

Dave
Re: Column resize redraw ignored (v 1.1.1) [message #1498251 is a reply to message #1497956] Thu, 04 December 2014 09:23 Go to previous messageGo to next message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 2902
Registered: July 2012
Senior Member
Quote:
The ColumnResizeCommand is routed ... only to the first child layer that responds true to the command.


That is a basic concept of NatTable command handling. Commands are transported down the layer stack until they are consumed. There are only very few exceptions to that where commands get never consumed. But typically only one handler/layer should react.

Quote:
The child layers are in CompositeLayer.childLayerToLayoutCoordinateMap, which is a HashMap


Yes I recently came across this one when implementing fixed regions at the bottom. Since that map is only used for that case and has the downside that it is not predictable what happens (as you mention) I removed this in the current code base which will be released with 1.2.0.

But if I understand you correctly, this change will cause that resize is never working again for you because the child layers are always asked to handle the resize command from top to bottom. And therefore the FilterRowDataLayer will always be the first in charge.

Now to your issue. First I don't know about your composition and why the FilterRowDataLayer is getting in charge first. I only use compositions where the filter row is below a column header, and the ColumnHeaderLayer takes the resize command and delegates it to its horizontal dependency first. So I assume you don't have a ColumHeaderLayer or some composition that breaks here.

With 1.1 we introduced a horizontal dependency from the FilterRowDataLayer to the ColumnHeaderLayer. This was necessary because there were some issues in more complex compositions where the position-index-transformation failed as the dimensional dependency was missing. That said a solution might be to modify FilterRowDataLayer#doCommand() to delegate a command to the ColumnHeaderLayer, which would be similar to the DimensionallyDependentLayer. For this please open a ticket.

If you have a column header you should check your composition as something doesn't seem right in that case. I am not able to reproduce that issue with a ColumnHeaderLayer in use.
Re: Column resize redraw ignored (v 1.1.1) [message #1499106 is a reply to message #1498251] Thu, 04 December 2014 23:11 Go to previous messageGo to next message
Dave Meibusch is currently offline Dave MeibuschFriend
Messages: 7
Registered: March 2010
Junior Member
Thanks Dirk for the quick and accurate reply. Greatly appreciate your work.

I'll check our composition - what you say makes sense. I suspect we have not configured the ColumnHeaderLayer correctly.

Dave
Re: Column resize redraw ignored (v 1.1.1) [message #1499404 is a reply to message #1499106] Fri, 05 December 2014 05:16 Go to previous messageGo to next message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 2902
Registered: July 2012
Senior Member
Thinking of this again, maybe the changes for 1.2.0 are the reason why I can't reproduce the issue anymore, since without the map the ColumnHeaderLayer is always the first in charge now.
Re: Column resize redraw ignored (v 1.1.1) [message #1506900 is a reply to message #1499404] Thu, 11 December 2014 06:38 Go to previous messageGo to next message
Dave Meibusch is currently offline Dave MeibuschFriend
Messages: 7
Registered: March 2010
Junior Member
Dirk,
Our header layer stack is constructed something like this:

public OurColumnHeaderLayer(bodyLayer, dataProvider, selectionLayer) {

DataLayer dataLayer = new DataLayer(dataProvider, ...)
ColumnHeaderLayer headerLayer = new ColumnHeaderLayer(dataLayer, bodyLayer, selectionLayer)
SortHeaderLayer sortHeaderLayer = new SortHeaderLayer(columnHeaderLayer,...)
FilterRowHeaderComposite filterRowHeader = new FilterRowHeaderComposite(.., sortHeaderLayer, dataProvider, ...)
setUnderlyingLayer(filterRowHeader)
}


That works - except for this resizing wrinkle. Have I got something 'round the wrong way here?

Dave

Re: Column resize redraw ignored (v 1.1.1) [message #1506983 is a reply to message #1506900] Thu, 11 December 2014 08:05 Go to previous message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 2902
Registered: July 2012
Senior Member
As said in the previous post, I think the issue exists with 1.1.x (and earlier?) because of the HashMap stuff you already noticed. With 1.2.0 this should be fixed. You could verify this using the latest SNAPSHOT build.

A workaround for the current release would be to implement doCommand() in your custom column header layer stack that delegates a ColumnResizeCommand (and the multiple version) directly to the ColumnHeaderLayer.

IIRC this shouldn't happen using a GridLayer, because the GridLayer should delegate the commands always in a dedicated order, starting from the body. So I assume you are not using a GridLayer but a custom composition. And in that case you could also override doCommand() in the CompositeLayer to perform a similar command delegation. This will work because the ColumnHeaderLayer is dimensionally dependent and therefore the command will be delegated there to the body aswell.
Previous Topic:Possible Memory Leak in NatCombo
Next Topic:Freeze column ,overrides Column reorder
Goto Forum:
  


Current Time: Thu Apr 25 04:49:43 GMT 2024

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

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

Back to the top