Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » NatTable » Avoid flickering when resize a table
Avoid flickering when resize a table [message #1132820] Fri, 11 October 2013 12:06 Go to next message
Eclipse UserFriend
Is there a reason for not avoid redrawing during the paintLayer procedure in NatLayerPainter?
If I resize a table I get a flickering GUI as long i do not set the control to redraw false.

Adding the following code the the paintLayer method in NatLayerPainter the flickering gets massively reduced.

org.eclipse.nebula.widgets.nattable.painter.layer.NatLayerPainter
public void paintLayer(ILayer natLayer, GC gc, int xOffset, int yOffset, Rectangle rectangle, IConfigRegistry configRegistry) {
  m_rowHeightCache.clearCache();
  try {
    natTable.setRedraw(false);
    // do stuff
  }
  finally {
    natTable.setRedraw(true);
  }
}


-Andreas
Re: Avoid flickering when resize a table [message #1132833 is a reply to message #1132820] Fri, 11 October 2013 12:16 Go to previous messageGo to next message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 2902
Registered: July 2012
Senior Member
Might have several reasons why it isn't done:

a) the guys who implemented it weren't aware of that this is possible
b) there are some use cases that break if you are doing this, which are not obvious

Some months ago I also tried to avoid some flickering issues on resizing. But I needed to reset my changes as there were other use cases where NatTables rendering was broken then.
Can't tell you what the real reason is or if your proposal wouldn't have any side effects. I can try to add your code and play around with our examples. If nothing is broken afterwards, I can add it to NatTable core.
Re: Avoid flickering when resize a table [message #1132851 is a reply to message #1132833] Fri, 11 October 2013 12:33 Go to previous messageGo to next message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 2902
Registered: July 2012
Senior Member
If I'm adding your proposed addition to the NatLayerPainter, the AutomaticRowHeightExample starts flickering a lot in the bounds. Even if the resize is done, the flickering appears.

So I really don't know the reasons, but your change breaks the almost clean behaviour in NatTable. IMHO some flickering on resize (which is not really flickering but inconsistent rendering at resize time) is better than real flickering if nothing is done.

Let me know if you have another idea. We are open for enhancements as long as NatTable 1.x is in active development.
Re: Avoid flickering when resize a table [message #1132927 is a reply to message #1132851] Fri, 11 October 2013 13:36 Go to previous messageGo to next message
Eclipse UserFriend
I got the same behavior.

The million question for now is:
Is a redraw(false) call the wrong approach or do we have an other issue to solve? The 'org.eclipse.scout.rt.ui.swt.basic.table.painter.patched.TextPainter.paintCell(ILayerCell, GC, Rectangle, IConfigRegistry)' method gets called "forever and ever again" in this example. Try to find the scheduler of these paint events...

-andreas
Re: Avoid flickering when resize a table [message #1132977 is a reply to message #1132927] Fri, 11 October 2013 14:19 Go to previous message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 2902
Registered: July 2012
Senior Member
Not sure if it is worth searching for the solution on this quite internal stuff. We will definitely have a closer look at the rendering in the next architecture, but for now it seems to work for most of the cases. Of course, if you want to try to find the issue, good luck. Smile

For your use case that row heights should also shrink automatically, maybe a different approach than letting the painter doing the row resizing could fit. What about attaching a listener for client area resizes. And after that you perform automatic resizing for all rows. Have a look here for some examples on automatic resizing http://eclipse.org/nattable/documentation.php?page=faq

For large tables this might be not the most performant solution, but this way you should avoid the flickering and minimize the resizing commands/events on rendering.
Previous Topic:Wrap text row height with more than one column
Next Topic:Collapse All Rows in TreeLayer
Goto Forum:
  


Current Time: Fri Mar 29 10:56:58 GMT 2024

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

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

Back to the top