Skip to main content



      Home
Home » Eclipse Projects » NatTable » Simple DataLayer filtering
Simple DataLayer filtering [message #1700336] Wed, 01 July 2015 21:38 Go to next message
Eclipse UserFriend
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 12:14 Go to previous messageGo to next message
Eclipse UserFriend
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 12:20 Go to previous message
Eclipse UserFriend
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 Jun 23 01:48:07 EDT 2025

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

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

Back to the top