Filter converted data [message #1816206] |
Wed, 23 October 2019 11:55  |
Eclipse User |
|
|
|
In my NatTable, I have a column of java.util.Calendar objects. Using a DisplayConverter, I convert such objects into strings to display them in this format, "2019-10-23 12:08:05+0200" using Java's SimpleDateFormat.
I would like to filter these strings in my FilterEditor. I have read and tried the advice in https://www.eclipse.org/forums/index.php/m/1700786/?srch=filter#msg_1700786 and in https://www.eclipse.org/forums/index.php?t=msg&th=1098416&goto=1805186&#msg_1805186 but it does not seem to work for me.
From what I understand, the intension with FilterRowConfigAttributes.FILTER_DISPLAY_CONVERTER is that the string that the user enters in FilterRowEditor shall be converted to the object held in the column, i.e. a Calendar object. It just doesn't make sense to me how a to convert a FilterEditor string like "12" into a Calendar object.
Therefore my question is: Is it possible to have it working the other way around, i.e. having the filter work against the strings that I see in my table instead of the Calendar instances that are held in the TransformedList?
|
|
|
|
|
|
|
|
Re: Filter converted data [message #1816463 is a reply to message #1816271] |
Tue, 29 October 2019 13:00   |
Eclipse User |
|
|
|
To illustrate my issue, I have attached a modified _6032_GlazedListsFilterCustomTypesExample.java in which I have added an extra "Date" column that will hold a java.util.Calendar object.
In it, I have pasted my aforementioned converter, "CalenderTimeToTextConverter", to get the desired output in the cells of the Date column.
On top of that, I have configured the TEXT_MATCHING_MODE:
configRegistry.registerConfigAttribute(
FilterRowConfigAttributes.TEXT_MATCHING_MODE,
TextMatchingMode.CONTAINS, DisplayMode.NORMAL,
FilterRowDataLayer.FILTER_ROW_COLUMN_LABEL_PREFIX + 5);
Now I would like to use the FilterRow cell in the Date column to search for the strings that I see in the Date column, but as you can see from this screenshot, in reality it searches the output of Calendar.toString(). Otherwise it would not have matched the string, "GregorianCalendar":

Please see my two attached files: "Modified_6032_GlazedListsFilterCustomTypesExample.java" and "string_search_in_date_column.png".
What should I do to make my FilterRow work against the formatted strings that I see in the Date column?
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03941 seconds