Author |
Message |
15/11/2012 18:22:16
|
bthalheim
Power User
Joined: 05/04/2012 11:45:24
Messages: 72
Offline
|
Hi,
I have a Grid with one column which shows an Enum.
My problem is, that the cardinal numbers of the enums do not reflect their functional order.
This would be no problem, as long as I am in Java code, I'd just use a custom Comparator for this enum.
Unfortunately, I cannot do this when I use sortreference in a fixgrid column.
Is there any way to not only specify a sort reference but also a specific comparator in my fixgrid column definition?
Basically, I'd need something like an attribute named sortreferencecomparator which responds to a getter to a java.util.Comparator.
Regards,
Björn
|
|
|
15/11/2012 18:40:01
|
CaptainCasa
Power User
Joined: 21/11/2007 12:23:06
Messages: 5555
Offline
|
Hi,
OK - we now introduced a mehod in FIXGRIDBinding that you can override:
Code:
/**
* Used by the default sorting: when a comparator is returned then this
* one is used for comparing values. If null is returned then the default
* comparator is used. - You need to override in order to apply special
* comparators for certain columns.
*/
protected Comparator<SortHelper> findSortComparatorForColumn(String sortReference)
{
return null;
}
You can pass an explicit Comparator for a column.
SortHelper is a simple class that holds the value to be sorted (SortHelper.getSortValue()).
Is part of next update (Mo).
Regards, Björn
|
Björn Müller, CaptainCasa GmbH |
|
|
19/11/2012 15:56:28
|
bthalheim
Power User
Joined: 05/04/2012 11:45:24
Messages: 72
Offline
|
Hi,
let's imagine my GridItem-Subclass has some Enum Attribute
Code:
public GridItemStatus getStatus() {
return m_GridItemStatus;
}
The Sort Order of these Enum Values is defined by a Comparator which can be obtained by using:
Code:
GridItemStatus.getComparator();
Now my Problem is, that the Method findSortComparatorForColumn needs a Comparator for SortHelper, not for my domain class.
Right now, I do have some trouble formulating that method so that it works, because I do not know anything about the SortHelper-World.
Could you provide some example code how to proceed in such a scenario?
Thanks,
Björn
|
|
|
06/12/2012 13:07:14
|
bthalheim
Power User
Joined: 05/04/2012 11:45:24
Messages: 72
Offline
|
Hi,
thanks Björn for your support, the current version of
Code:
findSortComparatorForColumnValue
is exactly what I needed.
Thanks,
Björn
|
|
|
|