Community
Participate
Working Groups
The TableViewer object is failing to display content defined by a contentprovider and labelprovider. Testing shows that label provider is not been called. The problem is occuring for existing code that has been working under 3.0 and is no longer working in 3.1 RC2. Sample code to follow. I have not yet confirmed if the issue exists on other host operating systems.
Created attachment 23500 [details] Sample test dialog with TableViewer component This is a complete class which will reproduce the problem.
The problem is in your content provider. When you call setInput you have the following code tableViewer.setInput(cp.getList()); Your content provider has public LinkedList getList() { return this.servers; } servers is null initially. As a result if the input is null there is nothing we can get elements from. As a result getElements() never gets called as you started with a null input. If you change this line to setInput(this) you code works. I ran this example in 3.0.2 as well and the behaviour was the same.
I will double-check. I think I may have been too quick with the sample code. Regards, Phil
I located the issue. It appears the meaning of SWT.VIRTUAL has changed. By removing SWT.VIRTUAL from the TableViewer constructor, my tables work fine. I'm not sure if this would still be considered a bug.
It's changed in that we actually support it now <grin>... previously we created everything - now we just create elements as they become visible.
Ok. So the problem is then that somehow the sample code is not triggering TableViewer that new items are visible. If you make the correction to the sample code you noted earlier, and add "SWT.VISIBLE" to the constructor you'll find that the content remains invisible. :) Phil
No - the problem is that your input was null so we were getting no elements. This code doesn't work in 3.0 either. All virtual does is fire your label providers when an entry becomes visible rather than all at once.
Created attachment 23568 [details] Corrected Sample Code This corrected sample code still fails. The ContentProvider initialization issue is corrected.
I think you attached an old file - this one is pretty much the same except for a shifted import.
getList() has been changed to auto-initialize the content provider. public LinkedList getList() { if (servers == null) getElements(null); return this.servers; } If you remove the SWT.VIRTUAL, the dialog displays correctly. Adding SWT.VIRTUAL causes content not to display. This shouldn't be the case if I understand correctly.
Thanks - I must have got the old version somehow. I cleaned yours up a bit to be a pure JFace app and on XP on RC3 it worked for me. Let me attach my version and let me know if it works for you - it might be an issue with the win 2003 server.
Created attachment 23570 [details] Version of your test class Your class with the GridLayout replaced by a swt GridLayout and import com.octetstring.vde.config.adapters.LdapHost; removed from the imports
Thanks. I ran your clean version of the test class. I get the same symptoms as before. FWIW...I'm testing on RC2. I will get the latest and re-confirm RC3. At this point, it appears that Windows 2003 Server doesn't work, while XP does.
OK thanks Phil - I suspected a wierd VIRTUAL issue. Updating and moving to SWT. SWT please see my version of the example which is running on XP.
I have confirmed that this is an issue on Windows 2003 and not XP. The problem is that we are not getting the SetData callback and so our label provider never gets called. I will attach an example action
Created attachment 23572 [details] Example SWT code in an Action
Note that my example is missing setItemCount which when added does work on Win 2003
This is not an SWT issue at all. I can replicate this on Windows XP on 2003. The issue is with setting item counts. If you want to use a VIRTUAL table the item count must be set. You need a line something like tableViewer.setInput(cp.getList()); tableViewer.setItemCount(cp.getList().size()); when you create the table viewer or the table has no idea how many items in needs to callabck for. In 3.0 we didn't support VIRTUAL so we created all of the TableItems for you - what you had was a non VIRTUAL table in that case. In 3.1 we are properly virtual but we need you to set the item count. This is really a dupe of 95811. *** This bug has been marked as a duplicate of 95811 ***