Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » NatTable » Problem with greyed out columns when table is resized
icon5.gif  Problem with greyed out columns when table is resized [message #1747599] Wed, 16 November 2016 12:11 Go to next message
Mike Rumpf is currently offline Mike RumpfFriend
Messages: 47
Registered: July 2009
Member
Hello guys,

I encountered a problem with a nattable (1.4) instance inside an e4-application which uses column freeze and manually set column widths:

Whenever the e4-window is resized and the horizontal scrollbar disappears (because the window is large enough to display the full table) all table columns (except the freezed columns) will be greyed out. If I make the window smaller and the scrollbar reappears, the display will be correct again.

Funny enough this problem doesn't occure on Windows 10 but only on Windows 7. It also doesn't occur in a standard java application but inside e4.
If I turn off freezing the columns or setting the column widths the problem disappears also.

Any ideas? Screenshot and an example-e4-project are attached.

Thanks in advance.
Mike
  • Attachment: problemnat.jpg
    (Size: 99.19KB, Downloaded 117 times)
  • Attachment: example.zip
    (Size: 11.23MB, Downloaded 52 times)
Re: Problem with greyed out columns when table is resized [message #1747608 is a reply to message #1747599] Wed, 16 November 2016 12:41 Go to previous messageGo to next message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 2614
Registered: July 2012
Senior Member
I tested this with the latest code base on Windows 7 and don't see that issue.

So maybe there was a bug that we have already fixed. Please test with the latest SNAPSHOT build to see if the issue persists.

I also see that you are setting a grid layout data to the NatTable but you are not setting the GridLayout to the parent Composite. At least I didn't see that. I remember issues with the layout of NatTable with other layout managers. Not sure if that could be related.
Re: Problem with greyed out columns when table is resized [message #1747616 is a reply to message #1747608] Wed, 16 November 2016 13:57 Go to previous messageGo to next message
Mike Rumpf is currently offline Mike RumpfFriend
Messages: 47
Registered: July 2009
Member
Thank you for fast your answer.

For the example I provided it helped to update to the snapshot version. However in our larger application the problem (surprisingly) still remains. Now I get an exception:

Nov 16, 2016 2:54:18 PM org.eclipse.nebula.widgets.nattable.painter.layer.NatLayerPainter paintLayer
SCHWERWIEGEND: Error while painting table
java.lang.NegativeArraySizeException
	at org.eclipse.nebula.widgets.nattable.selection.SelectionLayerPainter.paintLayer(SelectionLayerPainter.java:174)
	at org.eclipse.nebula.widgets.nattable.layer.CompositeLayer$CompositeLayerPainter.paintLayer(CompositeLayer.java:1040)
	at org.eclipse.nebula.widgets.nattable.freeze.CompositeFreezeLayer$FreezableLayerPainter.paintLayer(CompositeFreezeLayer.java:241)
	at org.eclipse.nebula.widgets.nattable.layer.CompositeLayer$CompositeLayerPainter.paintLayer(CompositeLayer.java:1040)
	at org.eclipse.nebula.widgets.nattable.painter.layer.NatLayerPainter.paintLayer(NatLayerPainter.java:54)
	at org.eclipse.nebula.widgets.nattable.NatTable.paintNatTable(NatTable.java:507)
	at org.eclipse.nebula.widgets.nattable.NatTable.paintControl(NatTable.java:502)
	at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:230)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
	at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4362)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1113)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1137)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1122)
	at org.eclipse.swt.widgets.Composite.WM_PAINT(Composite.java:1512)
	at org.eclipse.swt.widgets.Control.windowProc(Control.java:4733)
	at org.eclipse.swt.widgets.Canvas.windowProc(Canvas.java:339)
	at org.eclipse.swt.widgets.Display.windowProc(Display.java:5063)
	at org.eclipse.swt.internal.win32.OS.DefWindowProcW(Native Method)
	at org.eclipse.swt.internal.win32.OS.DefWindowProc(OS.java:2544)
	at org.eclipse.swt.widgets.Shell.callWindowProc(Shell.java:498)
	at org.eclipse.swt.widgets.Control.windowProc(Control.java:4774)
	at org.eclipse.swt.widgets.Canvas.windowProc(Canvas.java:339)
	at org.eclipse.swt.widgets.Decorations.windowProc(Decorations.java:1633)
	at org.eclipse.swt.widgets.Shell.windowProc(Shell.java:2117)
	at org.eclipse.swt.widgets.Display.windowProc(Display.java:5050)
	at org.eclipse.swt.internal.win32.OS.DefWindowProcW(Native Method)
	at org.eclipse.swt.internal.win32.OS.DefWindowProc(OS.java:2544)
	at org.eclipse.swt.widgets.Shell.callWindowProc(Shell.java:498)
	at org.eclipse.swt.widgets.Control.windowProc(Control.java:4774)
	at org.eclipse.swt.widgets.Canvas.windowProc(Canvas.java:339)
	at org.eclipse.swt.widgets.Decorations.windowProc(Decorations.java:1633)
	at org.eclipse.swt.widgets.Shell.windowProc(Shell.java:2117)
	at org.eclipse.swt.widgets.Display.windowProc(Display.java:5050)
	at org.eclipse.swt.internal.win32.OS.DispatchMessageW(Native Method)
	at org.eclipse.swt.internal.win32.OS.DispatchMessage(OS.java:2549)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3767)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$4.run(PartRenderingEngine.java:1127)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:337)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1018)
	at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:156)
	at org.eclipse.e4.ui.internal.workbench.swt.E4Application.start(E4Application.java:159)
	at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:134)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:380)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:235)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:606)
	at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:669)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:608)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1515)
	at org.eclipse.equinox.launcher.Main.main(Main.java:1488)


Re: Problem with greyed out columns when table is resized [message #1747617 is a reply to message #1747616] Wed, 16 November 2016 14:08 Go to previous messageGo to next message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 2614
Registered: July 2012
Senior Member
The SelectionLayerPainter was modified to add extended border drawing support. Seems there it has an issue for some special setups. Is it possible for you to provide an example to reproduce the issue? Seems to be related to freeze setups.
Re: Problem with greyed out columns when table is resized [message #1747623 is a reply to message #1747617] Wed, 16 November 2016 14:48 Go to previous messageGo to next message
Mike Rumpf is currently offline Mike RumpfFriend
Messages: 47
Registered: July 2009
Member
This is pretty weird: If i copy the table from the example product in our larger e4 application the problem remains (and the exception occurs). In the small e4-example everything is fine, though. It's the same table and there is no modification to the SelectionLayerPainter.

There must be some difference in the e4 product or as to how the parts are created. I'll continue to try to produce an example which will reproduce the issue.

Mike
Re: Problem with greyed out columns when table is resized [message #1747983 is a reply to message #1747623] Thu, 17 November 2016 12:46 Go to previous messageGo to next message
Mike Rumpf is currently offline Mike RumpfFriend
Messages: 47
Registered: July 2009
Member
I finally managed to reproduce the bug at my pc with a small example. As we just found out the problem also appears on some Win10 systems but not on all computers.

I hope you can reproduce it as well.

Thanks in advance,
Mike

PS: I also attached a few screenshots from my eclipse debugging session which might help as well.
  • Attachment: example.zip
    (Size: 11.24MB, Downloaded 53 times)
  • Attachment: illegal.jpg
    (Size: 57.29KB, Downloaded 105 times)
  • Attachment: illegal2.jpg
    (Size: 72.32KB, Downloaded 91 times)
  • Attachment: illegal3.jpg
    (Size: 132.32KB, Downloaded 86 times)
Re: Problem with greyed out columns when table is resized [message #1747990 is a reply to message #1747983] Thu, 17 November 2016 13:46 Go to previous messageGo to next message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 2614
Registered: July 2012
Senior Member
No I can't reproduce it. Two informations that would help additionally, natTable.getWidth() and columnPositionOffset as these values are used to calculate the number of columns

Second, are you only opening the example and resize the window or are you doing something additionally to force the issue?

The simple fix would be to change SelectionLayerPainter line 118 to

if (positionRectangle.width <= 0 || positionRectangle.height <= 0) {
    return;
}


you could test this locally if this fixes the issue, but I would like to understand better what is causing the issue to avoid follow up issues.
Re: Problem with greyed out columns when table is resized [message #1747992 is a reply to message #1747990] Thu, 17 November 2016 13:59 Go to previous messageGo to next message
Mike Rumpf is currently offline Mike RumpfFriend
Messages: 47
Registered: July 2009
Member
I only resize the window until the horizontal scrollbar disappears. The moment that happens, the exception occurs.

Here are all relevant variable values:

in paintLayer():
xOffset=179
yOffset=161
natLayer.getWidth()=1803
pixelRectangle=Rectangle {373, 161, 1430, 116}
positionRectangle=Rectangle {3, 5, -2, 4}
columnPositionOffset=3
rowPositionOffset=5


in getPositionRectangleFromPixelRectangle():
columnPositionOffset=3
rowPositionOffset=5
numColumns=-2
numRows=4

Thanks again for your help Smile
Re: Problem with greyed out columns when table is resized [message #1747995 is a reply to message #1747992] Thu, 17 November 2016 14:16 Go to previous messageGo to next message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 2614
Registered: July 2012
Senior Member
Please check your project setup. You have the NatTableExamples.jar in the classpath additionally to the core jar. This definitely doesn't make any sense. The NatTableExamples.jar is a fat jar that contains everything that is necessary to run the examples (despite the native SWT library). Dependent on which version of the examples you downloaded you might use a quite old version of NatTable and the painters. And mixing it with the 1.5 SNAPSHOT makes it quite unpredictable which classes are loaded. I for example could not debug because my sources in the workspace are 1.5 and the example loaded the classes from the examples jar which doesn't match.

Why do you include NatTable as jars in the product instead of consuming it via a target platform? It is not a good practice to consume libraries in an OSGi or Eclipse application like this.
Re: Problem with greyed out columns when table is resized [message #1747998 is a reply to message #1747995] Thu, 17 November 2016 14:40 Go to previous messageGo to next message
Mike Rumpf is currently offline Mike RumpfFriend
Messages: 47
Registered: July 2009
Member
Our business application does not have the nattable example jar included. It has a proper p2 target platform. The variable values I posted are from that application.

I only included it for the small standalone example.

But I will strip it down and see what happens.

Best regards,
Mike
Re: Problem with greyed out columns when table is resized [message #1748000 is a reply to message #1747998] Thu, 17 November 2016 15:14 Go to previous messageGo to next message
Mike Rumpf is currently offline Mike RumpfFriend
Messages: 47
Registered: July 2009
Member
Removing the nattable example jar from the lib folder did not help.
Re: Problem with greyed out columns when table is resized [message #1748001 is a reply to message #1748000] Thu, 17 November 2016 15:20 Go to previous messageGo to next message
Mike Rumpf is currently offline Mike RumpfFriend
Messages: 47
Registered: July 2009
Member
And here is the updated example zip with the libs removed.

Hope that helps.

Regards,
Mike
  • Attachment: example.zip
    (Size: 36.87KB, Downloaded 55 times)
Re: Problem with greyed out columns when table is resized [message #1748025 is a reply to message #1748001] Thu, 17 November 2016 21:09 Go to previous messageGo to next message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 2614
Registered: July 2012
Senior Member
I still can't reproduce the issue. Not sure what is going wrong on your machine. Nevertheless an exception should not happen and an appropriate check should be added.

I created the following ticket: https://bugs.eclipse.org/bugs/show_bug.cgi?id=507706
I also pushed a fix and merged it. Could you please test with the latest SNAPSHOT >= #574 and comment on the ticket if the issue is solved with this. Otherwise we should reopen the ticket to search for another solution.
Re: Problem with greyed out columns when table is resized [message #1748053 is a reply to message #1748025] Fri, 18 November 2016 08:31 Go to previous messageGo to next message
Mike Rumpf is currently offline Mike RumpfFriend
Messages: 47
Registered: July 2009
Member
Unfortunately it only helped to avoid the exception. The greyed out columns still appear.

Funny enough the problem seems to be somehow connected to the column widths which are set via setColumnWidthByPosition. If I toy around with the widths for some configurations the problem occurs for others it does not. But as far as I can see there is no system recognizable. Maybe it's some rounding issue in the algorithms?
Re: Problem with greyed out columns when table is resized [message #1748056 is a reply to message #1748053] Fri, 18 November 2016 08:52 Go to previous messageGo to next message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 2614
Registered: July 2012
Senior Member
Do you have scaling enabled on your Windows? I mean, is you display on 100% or higher?
icon3.gif  Re: Problem with greyed out columns when table is resized [message #1748058 is a reply to message #1748056] Fri, 18 November 2016 09:21 Go to previous messageGo to next message
Mike Rumpf is currently offline Mike RumpfFriend
Messages: 47
Registered: July 2009
Member
Oh, that's interesting: I iindeed had set the scaling to 125%. Now I changed the windows setting to 100% and the problem is gone!

Maybe this might help to reproduce the issue on your computer?

Regards,
Mike
Re: Problem with greyed out columns when table is resized [message #1748072 is a reply to message #1748058] Fri, 18 November 2016 10:41 Go to previous messageGo to next message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 2614
Registered: July 2012
Senior Member
Yes now I am able to reproduce the issue and yes it is a rounding issue. Basically it was introduced with the fix for https://bugs.eclipse.org/bugs/show_bug.cgi?id=493282

In the end the downscaling and the upscaling again doesn't result in the same integer pixel values because of the rounding.

Need to think about a proper solution.
Re: Problem with greyed out columns when table is resized [message #1748090 is a reply to message #1748072] Fri, 18 November 2016 12:07 Go to previous messageGo to next message
Mike Rumpf is currently offline Mike RumpfFriend
Messages: 47
Registered: July 2009
Member
Relieved to hear that you could reproduce the problem.

Let me know if you found a fix.

Best regards and thanks a lot,
Mike
Re: Problem with greyed out columns when table is resized [message #1748375 is a reply to message #1748090] Tue, 22 November 2016 15:02 Go to previous messageGo to next message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 2614
Registered: July 2012
Senior Member
I think I have found the issue. It looks like the mistake was in the aggregate size calculation on scaling. Instead of scaling every single column size, the sum of all column sizes was aggregated. This way some pixels where lost on up-scaling.

https://bugs.eclipse.org/bugs/show_bug.cgi?id=507856

I hopefully fixed it now and added some test cases to verify it. Would be great if you could verify this also with your application so we can be sure the bug is really fixed. The latest SNAPSHOT >= #575 should contain the fix.

BTW, I also realized another inconsistency this way. By setting the column width programmatically after the NatTable is initialized, the given pixel value is down-scaled. That means in the end the 127 pixels you want the column width to be is in the end only 102 up-scaled to 128. The reason is that the current implementation takes the parameter as user input (dragging a column border) and does not take into account the use case for programmatically setting the value.

I will think about a solution for this too, so the sizing and scaling is treated correctly. But that is another story in the end.
icon14.gif  Re: Problem with greyed out columns when table is resized [message #1748381 is a reply to message #1748375] Tue, 22 November 2016 15:34 Go to previous message
Mike Rumpf is currently offline Mike RumpfFriend
Messages: 47
Registered: July 2009
Member
Yes, it solved the issue. Thank you for the fix. Smile

Best regards,
Mike
Previous Topic:Groupby display name shows original name
Next Topic:DragSupport and reorderDragMode Doesn't works together
Goto Forum:
  


Current Time: Sun Sep 23 04:59:41 GMT 2018

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

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

Back to the top