Skip to main content



      Home
Home » Eclipse Projects » NatTable » Not all values displayed(Newbie question?)
Not all values displayed [message #1064595] Thu, 20 June 2013 03:44 Go to next message
Eclipse UserFriend
Dear all,

we have a problem with the Nattable - attachements are disabled in this forum, so I'll try to describe: Only the first row's values are actually displayed, though we can see that all col/row index combinations are called in the data provider.

The other rows are simply grey.

We create the table with this piece of code:
	  IDataProvider bodyDataProvider = new bdP(pageInput);
		  	
		  	DataLayer dataLayer = new DataLayer(bodyDataProvider);
		  	mhP mhP = new mhP(pageInput);
//		    DefaultColumnHeaderDataLayer columnHeaderDataLayer = new DefaultColumnHeaderDataLayer(new DefaultColumnHeaderDataProvider(new String[] {"C"}));
		    DefaultColumnHeaderDataLayer columnHeaderDataLayer = new DefaultColumnHeaderDataLayer(mhP);

		  	DefaultRowHeaderDataLayer rowHeaderLayer = new DefaultRowHeaderDataLayer(new rhP(pageInput));
		    DefaultCornerDataProvider cornerDataProvider = new DefaultCornerDataProvider(columnHeaderDataLayer.getDataProvider(), 
		    		rowHeaderLayer.getDataProvider()); 
		    CornerLayer cornerLayer = new CornerLayer( new DataLayer(cornerDataProvider), rowHeaderLayer, columnHeaderDataLayer);
		    GridLayer gridLayer = new GridLayer(dataLayer, columnHeaderDataLayer, rowHeaderLayer, cornerLayer); 
			NatTable natTable = new NatTable(form.getBody(), gridLayer);
			natTable.setLayoutData(new GridData(GridData.FILL_HORIZONTAL,GridData.FILL_VERTICAL));


Any help appreciated.
Re: Not all values displayed [message #1064599 is a reply to message #1064595] Thu, 20 June 2013 04:07 Go to previous messageGo to next message
Eclipse UserFriend
You need to ensure that headers and the body have the same amount of columns and rows. I guess your body data provider is not returning values for the rows. Is your body data provider of type ListDataProvider?
Re: Not all values displayed [message #1064605 is a reply to message #1064599] Thu, 20 June 2013 04:18 Go to previous messageGo to next message
Eclipse UserFriend
We have a custom implementation:
public class bdP implements IDataProvider {

		protected Object input;
		ImmutableList<FunctionFlowPort> oblist;
		Random rand = new Random();
		public bdP(Object input) {
			this.input = input;
			if (input instanceof Identifiable) {
				Identifiable id = (Identifiable) input;
				oblist = ImmutableList.copyOf(Iterators.filter(id.eAllContents(),FunctionFlowPort.class));
			}
		}
		@Override
		public Object getDataValue(int columnIndex, int rowIndex) {
			if (logger.isDebugEnabled()) {
				logger.debug("getDataValue(" + columnIndex + ", " + rowIndex + ") - start"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
			}

			Object returnObject = new Integer(rand.nextInt(2));
			if (logger.isDebugEnabled()) {
				logger.debug("getDataValue(int, int) - end - return value=" + returnObject); //$NON-NLS-1$
			}
			return returnObject;

			
		}

		@Override
		public void setDataValue(int columnIndex, int rowIndex, Object newValue) {
			
		}

		@Override
		public int getColumnCount() {
			if (logger.isDebugEnabled()) {
				logger.debug("getColumnCount() - start"); //$NON-NLS-1$
			}

			int returnint = oblist.size();
			if (logger.isDebugEnabled()) {
				logger.debug("getColumnCount() - end - return value=" + returnint); //$NON-NLS-1$
			}
			return returnint;
		}

		@Override
		public int getRowCount() {
			if (logger.isDebugEnabled()) {
				logger.debug("getRowCount() - start"); //$NON-NLS-1$
			}

			int returnint = oblist.size();
			if (logger.isDebugEnabled()) {
				logger.debug("getRowCount() - end - return value=" + returnint); //$NON-NLS-1$
			}
			return returnint;
		}
		
		
	}


Both rowCount of the row header provider and body data provider return "7" in this specific case. However, getDataValue is called with a maximum rowIndex of 3.

Regards,

Andreas

Re: Not all values displayed [message #1064614 is a reply to message #1064605] Thu, 20 June 2013 05:04 Go to previous messageGo to next message
Eclipse UserFriend
Does your columnheader dataprovider return the same value for column count as your body dataprovider?
Re: Not all values displayed [message #1064622 is a reply to message #1064614] Thu, 20 June 2013 05:29 Go to previous messageGo to next message
Eclipse UserFriend
Yes, .. they operate all on the same list. Is there a way to enable attachments in the forum so that i can send a screentshot?
Re: Not all values displayed [message #1064623 is a reply to message #1064622] Thu, 20 June 2013 05:44 Go to previous messageGo to next message
Eclipse UserFriend
Why don't you extend the ListDataProvider if you are using a list for showing data in the NatTable?

You should be able to add a screenshot
Re: Not all values displayed [message #1064624 is a reply to message #1064622] Thu, 20 June 2013 05:45 Go to previous messageGo to next message
Eclipse UserFriend
It is running, we had used the example in the Eclipse Wiki and are now using the one from the example files. That helps....
Re: Not all values displayed [message #1064625 is a reply to message #1064624] Thu, 20 June 2013 05:46 Go to previous messageGo to next message
Eclipse UserFriend
Why not List data Provider? I think that uses reflections / beans? But they values displayed will not be able to be calculated in that way.
Re: Not all values displayed [message #1064626 is a reply to message #1064624] Thu, 20 June 2013 05:46 Go to previous messageGo to next message
Eclipse UserFriend
There is a wiki for NatTable? Really? Who edits it? We have our own documentation site. It isn't complete, but we are working on that now.
Re: Not all values displayed [message #1064656 is a reply to message #1064626] Thu, 20 June 2013 08:54 Go to previous messageGo to next message
Eclipse UserFriend
I meant the example on the Eclipse Wiki ... http://www.eclipse.org/nattable/documentation.php?page=examples
Re: Not all values displayed [message #1064673 is a reply to message #1064656] Thu, 20 June 2013 09:45 Go to previous message
Eclipse UserFriend
First, it is not a wiki. Smile

Second, why did the example explained there not work? It uses the ListDataProvider, while you didn't. I'm just asking because we are working on the documentation, and if there is an error in the current docs, we will correct them right away for the new documentation.
Previous Topic:Exception when using DefaultGlazedListsStaticFilterStrategy
Next Topic:Issue with Nattable StructuralRefresh command
Goto Forum:
  


Current Time: Wed Jul 23 21:55:34 EDT 2025

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

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

Back to the top