Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » NatTable » GlazedLists FIlter Strategy for Custom Object
GlazedLists FIlter Strategy for Custom Object [message #1422270] Fri, 12 September 2014 15:32 Go to next message
Phaedrus The Greek is currently offline Phaedrus The GreekFriend
Messages: 17
Registered: August 2011
Junior Member
Hi,

I have a Cell that has a DataValue that is a Custom Object.
I would like to use Text Filtering, but by default it searches the Object.toString() which is not what I want, instead i will provide a custom converter that does Object.getSearchableString() or the like.

I figured that i could use a DefaultGlazedListFilterStrategy and Override getTextFilterator, and maybe that would work, but I would prefer to be able to provide a DisplayConverter via ConfigAttribute for this purpose.

What is the recommended approach?

Appreciated,

Jay
Re: GlazedLists FIlter Strategy for Custom Object [message #1422353 is a reply to message #1422270] Fri, 12 September 2014 18:33 Go to previous messageGo to next message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 2902
Registered: July 2012
Senior Member
You need to register a IDisplayConverter for the ConfigAttribute FilterRowConfigAttributes.FILTER_DISPLAY_CONVERTER

The corresponding example can be found in the examples app: Tutorial Examples -> GlazedLists -> Filter -> GlazedListsFilterCustomTypesExample
Re: GlazedLists FIlter Strategy for Custom Object [message #1422901 is a reply to message #1422353] Sat, 13 September 2014 15:41 Go to previous messageGo to next message
Phaedrus The Greek is currently offline Phaedrus The GreekFriend
Messages: 17
Registered: August 2011
Junior Member
I did do that, but received a ClassCastException (String) when it tried to use the same filter for the header/filter row, in which i typed the search text.

I suppose as a workaround i could just catch the exception and pass the string.
Re: GlazedLists FIlter Strategy for Custom Object [message #1423325 is a reply to message #1422901] Sun, 14 September 2014 08:03 Go to previous messageGo to next message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 2902
Registered: July 2012
Senior Member
Did you ensure to also register the converter for the column itself? Without seeing what you did I don't know about your issue in detail and what you did wrong. The example works with custom types, so I assume you missed something and you don't need to catch anything.

One further question: Are you using a combo box for filtering or a text field? Because if you are using a text field, are you sure the converter is able to resolve the custom type by a incomplete String?

[Updated on: Sun, 14 September 2014 08:09]

Report message to a moderator

Re: GlazedLists FIlter Strategy for Custom Object [message #1424365 is a reply to message #1423325] Mon, 15 September 2014 22:06 Go to previous message
Phaedrus The Greek is currently offline Phaedrus The GreekFriend
Messages: 17
Registered: August 2011
Junior Member
It's a text field, which is i think where my problem is. I'm not sure how to convert an incomplete string to a type ... but i do have an idea on how to solve the problem now. Thank you.
Previous Topic:GlazedList.clear() throws java.lang.IndexOutOfBoundsException
Next Topic:NatTable 1.1.1 released!
Goto Forum:
  


Current Time: Thu Apr 25 04:57:25 GMT 2024

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

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

Back to the top