Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » NatTable » Simple DataLayer filtering
Simple DataLayer filtering [message #1700336] Thu, 02 July 2015 01:38 Go to next message
Noah Benham is currently offline Noah BenhamFriend
Messages: 1
Registered: July 2015
Junior Member
I'm attempting to setup a simple static filter on a list, with the existing DataLayer implementation as

rowDataLayer = new SpanningDataLayer(getRowDataProvider()); // getRowDataProvider() returns ISpanningDataProvider


Could someone point me in the right direction please? After looking through the examples, I've come up with the following replacement, although I'm getting null pointer exceptions - I'm probably misunderstanding something simple.

//create a new ConfigRegistry which will be needed for GlazedLists handling
ConfigRegistry configRegistry = new ConfigRegistry();
   		
CompositeMatcherEditor<String> autoFilterMatcherEditor = new CompositeMatcherEditor<String>();
  
DefaultGlazedListsStaticFilterStrategy<String> filterStrategy = new DefaultGlazedListsStaticFilterStrategy<String>(autoFilterMatcherEditor, null, configRegistry);
filterStrategy.addStaticFilter(new Matcher<String>() {

	@Override
	public boolean matches(String item) {
		return true; // for testing - match everything for now
	}
});
   		
rowDataLayer = new FilterRowDataLayer<String>(filterStrategy, rowDataLayer, getRowDataProvider(), configRegistry);
Re: Simple DataLayer filtering [message #1700450 is a reply to message #1700336] Thu, 02 July 2015 16:14 Go to previous messageGo to next message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 2803
Registered: July 2012
Senior Member
You are passing null for the necessary column accessor. Without that the filter is not able to access the column values of row objects.
Re: Simple DataLayer filtering [message #1700453 is a reply to message #1700450] Thu, 02 July 2015 16:20 Go to previous message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 2803
Registered: July 2012
Senior Member
For simple cases you can also give the AbstractFilterListDataProvider a try.

http://download.eclipse.org/nattable/releases/1.0.0/apidocs/org/eclipse/nebula/widgets/nattable/data/AbstractFilterListDataProvider.html

But note that it doesn't scale well with big data sets.
Previous Topic:Preserve Selection On Sorting
Next Topic:Is searching supported?
Goto Forum:
  


Current Time: Mon Mar 08 15:47:39 GMT 2021

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

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

Back to the top