Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » NatTable » How to Use Wild-card Filter Support in NatTable(Wild-card Filter support for Nat table)
How to Use Wild-card Filter Support in NatTable [message #1706644] Fri, 28 August 2015 11:27 Go to next message
Shashi Mising name is currently offline Shashi Mising nameFriend
Messages: 47
Registered: August 2011
Member
Dear All,

I Created a nat table with the filter row header and use the filter list and DefaultGlazedListsFilterStrategy like below

// build the filter strategy to filter the table data
DefaultGlazedListsFilterStrategy<Object> filterStrategy = new DefaultGlazedListsFilterStrategy<Object>(
filterList, IColumnPropertyAccessor
configRegistry);

// Configure the regular expression filter on Column
configRegistry.registerConfigAttribute(
FilterRowConfigAttributes.TEXT_MATCHING_MODE,
TextMatchingMode.REGULAR_EXPRESSION, DisplayMode.NORMAL, 5) ;

but when i filter with the pattern "*abc", the filter is not working, it is not giving the result with name as expected [for example: expectation here is filter should provide the filterList with the data like xyzabc, pqrabcty].

so how to make it possible?

Thank you

Regards
Shashi
Re: How to Use Wild-card Filter Support in NatTable [message #1706646 is a reply to message #1706644] Fri, 28 August 2015 12:14 Go to previous messageGo to next message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 2902
Registered: July 2012
Senior Member
I think the label you are registering the TEXT_MATCHING_MODE for is wrong. It should be

FilterRowDataLayer.FILTER_ROW_COLUMN_LABEL_PREFIX + 5

instead of only 5
Re: How to Use Wild-card Filter Support in NatTable [message #1706805 is a reply to message #1706646] Mon, 31 August 2015 09:45 Go to previous messageGo to next message
Shashi Mising name is currently offline Shashi Mising nameFriend
Messages: 47
Registered: August 2011
Member
Thank you for your kind response.

one more problem is that the filter works only for the "*" delimiter because i register only '*' delimiter.

configRegistry.registerConfigAttribute(
FilterRowConfigAttributes.TEXT_DELIMITER, "*");

but it is not working for other regular expression.

For example : if Enter ^123 [Any character except 123 (negation)] should display, but the filter is not working as expected in this case.

if i do register like
configRegistry.registerConfigAttribute(
FilterRowConfigAttributes.TEXT_DELIMITER, "^");

here the filter behavior is same for both * and ^ but it should not be , so how to achieve the filter should work for regular expressions correctly.

Thank you

Regards
Shashi
Re: How to Use Wild-card Filter Support in NatTable [message #1706815 is a reply to message #1706805] Mon, 31 August 2015 11:09 Go to previous messageGo to next message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 2902
Registered: July 2012
Senior Member
TEXT_DELIMITER is used to be able add several filter conditions, e.g. to support an AND condition. In our examples this is done by registering the & sign. I don't understand why you are using a delimiter for your use case.

Your regular expression is not correct. If you want to show everything except 123 it should be ^(123)
Re: How to Use Wild-card Filter Support in NatTable [message #1706822 is a reply to message #1706815] Mon, 31 August 2015 12:03 Go to previous messageGo to next message
Shashi Mising name is currently offline Shashi Mising nameFriend
Messages: 47
Registered: August 2011
Member
Thank you Dirk for your valuable input.

If i didn't use TEXT_DELIMITER the filter will not work and throw the following
Warning.

org.eclipse.nebula.widgets.nattable.extension.glazedlists.filterrow.DefaultGlazedListsFilterStrategy applyFilter
WARNING: Error on applying a filter: Dangling meta character '*' near index 0


if i add the TEXT_DELIMITER for "*" the warning wont throw and filter work
only for this * sign not for others.

Even i check for some columns in the example _6031_GlazedListsFilterExample

in this example also the behavior same as above.

is it required any extra configuration, if not why it is not working?

Thank you

Regards
Shashi
Re: How to Use Wild-card Filter Support in NatTable [message #1706823 is a reply to message #1706822] Mon, 31 August 2015 12:15 Go to previous messageGo to next message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 2902
Registered: July 2012
Senior Member
Maybe you need to get familiar with regular expressions first.
https://docs.oracle.com/javase/tutorial/essential/regex/index.html

The * is a meta character in regular expressions for the quantifier "zero or more times". The exception tells you that you are using a quantifier without an expression where the quantifier should be applied to.

The regular expression you are looking for is (.*)abc, which means "any character, zero or more times, end with abc"

If you want this to be simplified somehow, you might want to implement a converter for the filter row that transforms the user input '*' to a data input '(.*)' and vice versa
Re: How to Use Wild-card Filter Support in NatTable [message #1707025 is a reply to message #1706823] Tue, 01 September 2015 14:59 Go to previous message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 2902
Registered: July 2012
Senior Member
https://bugs.eclipse.org/bugs/show_bug.cgi?id=476348
Previous Topic:ColumnOverrideAccumulator to ColumnGroupHeaderLayer or ColumnGroupGroupHeaderLayer
Next Topic:Disable row selection in NatTable
Goto Forum:
  


Current Time: Fri Apr 19 07:51:58 GMT 2024

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

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

Back to the top