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 08:06 Go to next message
Andreas Hoegger is currently offline Andreas Hoegger
Messages: 173
Registered: February 2010
Senior Member
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 08:16 Go to previous messageGo to next message
Dirk Fauth is currently offline Dirk Fauth
Messages: 1205
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 08:33 Go to previous messageGo to next message
Dirk Fauth is currently offline Dirk Fauth
Messages: 1205
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 09:36 Go to previous messageGo to next message
Andreas Hoegger is currently offline Andreas Hoegger
Messages: 173
Registered: February 2010
Senior Member
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 10:19 Go to previous message
Dirk Fauth is currently offline Dirk Fauth
Messages: 1205
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:Row numbers are also changed , when rows are reordered using row reorder layer
Goto Forum:
  


Current Time: Tue Jul 22 17:42:19 EDT 2014

Powered by FUDForum. Page generated in 0.02009 seconds