Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » NatTable » Filter and Search with separate text box
Filter and Search with separate text box [message #1076187] Tue, 30 July 2013 22:39 Go to next message
Ralf Heydenreich is currently offline Ralf HeydenreichFriend
Messages: 235
Registered: July 2009
Senior Member
Hi all,
I've build a NatTable with GlazedLists that is displayed correctly. Now I want to have a text field outside the table. While typing in this field the table should be refreshed with matching data. "Matching data" means that each cell in the underlying list is compared to the input string and if one item matches the row should be placed in the resulting list.
I've looked in GridSearchStrategy but didn't get it to work (and didn't know if it's the right place). How can I achieve this? The search fields have to be configurable, i.e. the table consists of "col1", "col2", "col3" and the search should only look through "col1" and "col3".

TIA,
Ralf.
Re: Filter and Search with separate text box [message #1076335 is a reply to message #1076187] Wed, 31 July 2013 07:36 Go to previous messageGo to next message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 2902
Registered: July 2012
Senior Member
What are you trying to achieve? Searching or filtering?

For me it sound more that you want to filter. In that case you should consider using a FilterList and add a filter for your input in the text field. So you might want to have a look at the filter examples and search for informations about filtering in GlazedLists.

In short, you should add the GlazedListsEventLayer to your layer stack, use a FilterList on top of the GlazedLists stack and apply a Matcher to your FilterList everytime there is an input in your text field.
Re: Filter and Search with separate text box [message #1085126 is a reply to message #1076335] Mon, 12 August 2013 13:39 Go to previous messageGo to next message
Ralf Heydenreich is currently offline Ralf HeydenreichFriend
Messages: 235
Registered: July 2009
Senior Member
Hi Dirk, thx for your reply. Indeed, the solution is a filter field. I've looked through GlazedListsExamples and found exactly what I've searched. Thanks again for this hint.

Ralf.
Re: Filter and Search with separate text box [message #1246393 is a reply to message #1076335] Sat, 15 February 2014 02:01 Go to previous messageGo to next message
Ralf Heydenreich is currently offline Ralf HeydenreichFriend
Messages: 235
Registered: July 2009
Senior Member
Am 31.07.2013 09:36, schrieb Dirk Fauth:
> What are you trying to achieve? Searching or filtering?
>
> For me it sound more that you want to filter. In that case you should
> consider using a FilterList and add a filter for your input in the text
> field. So you might want to have a look at the filter examples and
> search for informations about filtering in GlazedLists.
>
> In short, you should add the GlazedListsEventLayer to your layer stack,
> use a FilterList on top of the GlazedLists stack and apply a Matcher to
> your FilterList everytime there is an input in your text field.

Hi Dirk,
sorry for exhuming this old thread... The TextFilterator is the right
class, I know it now. But I can't put it all together in my SWT sample
app. This is what I have:

EventList<MyRowObject> eventList =
GlazedLists.eventList(createMyRowObjects(9));
Text filterText = new Text(panel, SWT.NONE);
GlazedListsGridLayer<MyRowObject> gridLayer = new
GlazedListsGridLayer<MyRowObject>(eventList,
columnPropertyAccessor, columnHeaderDataProvider, configRegistry,
true); gridLayer.getBodyDataLayer().setConfigLabelAccumulator(new
ColumnLabelAccumulator());
final DataLayer n6DataLayer = gridLayer.getBodyDataLayer();
MatcherEditor<MyRowObject> textMatcherEditor = new
TextWidgetMatcherEditor<MyRowObject>(
filterText, new IssueTextFilterator());
GlazedListsEventLayer<MyRowObject> evtLayer = new
GlazedListsEventLayer<MyRowObject>(n6DataLayer, eventList);
FilterList<MyRowObject> textFilteredIssues = new FilterList<MyRowObject>
(sortedIssues, textMatcherEditor);


Now, how do I put the evtLayer over the GlazedListsLayer? Do I have to
use some stuff like
GlazedListsSWT.eventTableViewerWithThreadProxyList()? Would be glad if
you could help me...

TIA,
Ralf.
Re: Filter and Search with separate text box [message #1247757 is a reply to message #1246393] Sun, 16 February 2014 15:20 Go to previous messageGo to next message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 2902
Registered: July 2012
Senior Member
Hi,

there are several things that are not correct.

1. A GlazedListsSWT.eventTableViewerWithThreadProxyList() is creating a new viewer based on a Table. That has nothing to do with NatTable!
2. You are using the GlazedListsGridLayer which is only contained in the examples. You should never rely on something in an example project. It is there to show how to build a custom grid layer that is using GlazedLists.
3. You are adding an additional GlazedListsEventLayer on top of the DataLayer. So you are creating a new path in the layer stack next to the original one. It is not possible to attach that into the layer stack afterwards. The layer composition does not support such plugin ability.

Said that, why don't you create your own GlazedListsGridLayer that supports your use case? BTW, the GlazedListsGridLayer already contains a GlazedListsEventLayer. But it is not build on a FilterList. So you definitely need to create your own stack.

Greez,
Dirk
Re: Filter and Search with separate text box [message #1247975 is a reply to message #1247757] Sun, 16 February 2014 21:04 Go to previous messageGo to next message
Ralf Heydenreich is currently offline Ralf HeydenreichFriend
Messages: 235
Registered: July 2009
Senior Member
Am 16.02.2014 16:20, schrieb Dirk Fauth:
> Hi,
>
> there are several things that are not correct.
>
> 1. A GlazedListsSWT.eventTableViewerWithThreadProxyList() is creating a
> new viewer based on a Table. That has nothing to do with NatTable!
> 2. You are using the GlazedListsGridLayer which is only contained in the
> examples. You should never rely on something in an example project. It
> is there to show how to build a custom grid layer that is using
> GlazedLists.
> 3. You are adding an additional GlazedListsEventLayer on top of the
> DataLayer. So you are creating a new path in the layer stack next to the
> original one. It is not possible to attach that into the layer stack
> afterwards. The layer composition does not support such plugin ability.
>
> Said that, why don't you create your own GlazedListsGridLayer that
> supports your use case? BTW, the GlazedListsGridLayer already contains a
> GlazedListsEventLayer. But it is not build on a FilterList. So you
> definitely need to create your own stack.
>
> Greez,
> Dirk


Hi Dirk,
I guess I didn't fully understand the mechanics behind NatTable and
GlazedLists. But for now, it works. I've set up my own stack (and yes, I
could remove some code!). Now the filtering is working perfectly. Thanks
for your help!

Regards,
Ralf.
Re: Filter and Search with separate text box [message #1578295 is a reply to message #1247975] Thu, 22 January 2015 10:03 Go to previous messageGo to next message
Gal Rogozinski is currently offline Gal RogozinskiFriend
Messages: 40
Registered: June 2014
Member
Hey,
I have a grid with filters based on a FilterList. It works fine but I never added the GlazedListsEventLayer to the stack.
Why is this layer neccessary? How does filtering works without it?
Re: Filter and Search with separate text box [message #1578330 is a reply to message #1578295] Thu, 22 January 2015 10:26 Go to previous message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 2902
Registered: July 2012
Senior Member
The GlazedListsEventLayer is used to automatically transforming list events from GlazedLists to NatTable events to trigger repainting.

Filtering might work without it, because after applying a filter, a repaint is triggered manually.
Previous Topic:Multi-Edit of Checkbox
Next Topic:Upgrade from SourceForge 0.9 To Nebula 1.0.1
Goto Forum:
  


Current Time: Fri Apr 19 16:45:24 GMT 2024

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

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

Back to the top