Sorting Problem

57 views
Skip to first unread message

Sam Welter

unread,
Jul 19, 2012, 3:16:35 PM7/19/12
to jmesa...@googlegroups.com
For me, jmesa throws errors when I try to sort on columns that contain child object properties. For example, my referral table has a business line in it:
 
HtmlColumn business = new HtmlColumn("businessLine.name").title("Business").filterable(false);
When I click the column header, I get this error in the log -
 
GenericErrorPageException:
org.apache.commons.collections.comparators.ComparableComparator.compare(ComparableComparator.java:92)
org.apache.commons.collections.comparators.NullComparator.compare(NullComparator.java:140)
org.apache.commons.beanutils.BeanComparator.compare(BeanComparator.java:159)
org.apache.commons.collections.comparators.ComparatorChain.compare(ComparatorChain.java:278)
java.util.Arrays.mergeSort(Arrays.java:1284)
java.util.Arrays.mergeSort(Arrays.java:1295)
java.util.Arrays.sort(Arrays.java:1223)
java.util.Collections.sort(Collections.java:159)
org.jmesa.core.sort.MultiColumnSort.sortItems(MultiColumnSort.java:49)
org.jmesa.core.Items.<init>(Items.java:50)
org.jmesa.core.CoreContextFactory.createCoreContext(CoreContextFactory.java:171)
org.jmesa.facade.TableFacade.getCoreContext(TableFacade.java:667)
org.jmesa.facade.TableFacadeUtils.initTable(TableFacadeUtils.java:161)
org.jmesa.facade.TableFacade.getTable(TableFacade.java:701)
org.jmesa.facade.TableFacade.setView(TableFacade.java:832)
org.jmesa.facade.TableFacade.getView(TableFacade.java:793)
org.jmesa.facade.TableFacade.render(TableFacade.java:846)
org.jmesa.model.TableModel.render(TableModel.java:325)
 
I tried adding a CellEditor, like this:
 
        HtmlColumn business = new HtmlColumn("businessLine").title("Business").filterable(false);
        subSrc.setCellEditor(new CellEditor() {
            public Object getValue(Object item, String property, int rowcount) {
                Object value = ItemUtils.getItemValue(item, property);
                return ((BusinessLine) value).getName();
            }
        });
 
But that didn't work either. It seems to work
 
Do you have any insight as to why this is happening? Please let me know.
 
Thanks,

Sam

Sam Welter

unread,
Jul 26, 2012, 1:53:22 PM7/26/12
to jmesa_forum
Any thoughts on this issue?

On Jul 19, 2:16 pm, Sam Welter <samuel.r.wel...@gmail.com> wrote:
> For me, jmesa throws errors when I try to sort on columns that contain
> child object properties. For example, my referral table has a business line
> in it:
>
>  HtmlColumn business = new
> HtmlColumn("businessLine.name").title("Business").filterable(false);
> When I click the column header, I get this error in the log -
>
> GenericErrorPageException:
> org.apache.commons.collections.comparators.ComparableComparator.compare(Com­parableComparator.java:92)
> org.apache.commons.collections.comparators.NullComparator.compare(NullCompa­rator.java:140)
> org.apache.commons.beanutils.BeanComparator.compare(BeanComparator.java:159­)
> org.apache.commons.collections.comparators.ComparatorChain.compare(Comparat­orChain.java:278)

zaq

unread,
Aug 7, 2012, 11:06:52 AM8/7/12
to jmesa...@googlegroups.com
Sam,
  I'm not sure what version of Jmesa you are using.  I'm still using jmesa 3.0.3.  But I am not experiencing the issue you are.

My list of objects that jmesa uses have sub beans in like you mention.  and I use sortable columns for values in those sub beans.

as an example I have these:
<jmesa:htmlColumn title="Forecast East" property="eastInformation.forecastQty" filterable="false" sortable="true"/>
<jmesa:htmlColumn title="Method Used East" sortable="true" property="eastInformation.methodName" filterEditor="mil.usmc.logcom.mdft.jmesa.droplistFilterEditorWithBlank" />

forecastQty is an integer, and methodName is String.  both are values in the sub bean eastInformation.  And both sort properly from the tag version of jmesa.
       
None of the pages where I control the jmesa table from the java side like you are do I use sub objects.  I really only use the java controls for tables that I need to customize the export or are editable.  So I can't help from that side right now. 

Have you tried using the tag library version just to see if it works the same way?

Anyway I just thought you would like to hear from someone about this.  Sorry I couldn't be more help.

Jeff Johnston

unread,
Aug 7, 2012, 12:11:56 PM8/7/12
to jmesa...@googlegroups.com
Sorry, missed this post.

What I would do is take the defaut sort class, copy it into your project, and then reference that. Then you can more easily debug it. There isn't much to it. Also, it should work the same regardless of using the tags or not...

http://code.google.com/p/jmesa/wiki/SortRecipes

http://code.google.com/p/jmesa/source/browse/tags/jmesa-3.0/src/org/jmesa/core/sort/MultiColumnSort.java

Sorry about the slow responses lately. I have had a lot of things going on and just do not have as much time to commit to the project. At least by using it internally where I work the project keeps moving forward!

-Jeff Johnston

Sam Welter

unread,
Sep 10, 2012, 6:12:41 PM9/10/12
to jmesa_forum
Zaq & Jeff - thank you both for your replies. I got side-tracked on
this issue and I haven't been able to discover any additional
diagnostic information. If I do, I will post.

Best,

Sam

On Aug 7, 9:11 am, Jeff Johnston <jeff.johnston...@gmail.com> wrote:
> Sorry, missed this post.
>
> What I would do is take the defaut sort class, copy it into your project,
> and then reference that. Then you can more easily debug it. There isn't
> much to it. Also, it should work the same regardless of using the tags or
> not...
>
> http://code.google.com/p/jmesa/wiki/SortRecipes
>
> http://code.google.com/p/jmesa/source/browse/tags/jmesa-3.0/src/org/j...
> >> > HtmlColumn("businessLine.name"**).title("Business").**filterable(false);
>
> >> > When I click the column header, I get this error in the log -
>
> >> > GenericErrorPageException:
> >> > org.apache.commons.**collections.comparators.**
> >> ComparableComparator.compare(**Com­parableComparator.java:92)
> >> > org.apache.commons.**collections.comparators.**NullComparator.compare(*
> >> *NullCompa­rator.java:140)
> >> > org.apache.commons.beanutils.**BeanComparator.compare(**BeanComparator.java­:159­)
>
> >> > org.apache.commons.**collections.comparators.**ComparatorChain.compare(
> >> **Comparat­orChain.java:278)
> >> > java.util.Arrays.mergeSort(**Arrays.java:1284)
> >> > java.util.Arrays.mergeSort(**Arrays.java:1295)
> >> > java.util.Arrays.sort(Arrays.**java:1223)
> >> > java.util.Collections.sort(**Collections.java:159)
> >> > org.jmesa.core.sort.**MultiColumnSort.sortItems(**MultiColumnSort.java:49)
>
> >> > org.jmesa.core.Items.<init>(**Items.java:50)
> >> > org.jmesa.core.**CoreContextFactory.**createCoreContext(**CoreContextFactor­y.java­:171)
>
> >> > org.jmesa.facade.TableFacade.**getCoreContext(TableFacade.**java:667)
> >> > org.jmesa.facade.**TableFacadeUtils.initTable(**TableFacadeUtils.java:161)
>
> >> > org.jmesa.facade.TableFacade.**getTable(TableFacade.java:701)
> >> > org.jmesa.facade.TableFacade.**setView(TableFacade.java:832)
> >> > org.jmesa.facade.TableFacade.**getView(TableFacade.java:793)
> >> > org.jmesa.facade.TableFacade.**render(TableFacade.java:846)
> >> > org.jmesa.model.TableModel.**render(TableModel.java:325)
>
> >> > I tried adding a CellEditor, like this:
>
> >> >          HtmlColumn business = new
> >> > HtmlColumn("businessLine").**title("Business").filterable(**false);
> >> >         subSrc.setCellEditor(new CellEditor() {
> >> >             public Object getValue(Object item, String property, int
> >> > rowcount) {
> >> >                 Object value = ItemUtils.getItemValue(item, property);
> >> >                 return ((BusinessLine) value).getName();
> >> >             }
> >> >         });
>
> >> > But that didn't work either. It seems to work
>
> >> > Do you have any insight as to why this is happening? Please let me
> >> know.
>
> >> > Thanks,
>
> >> > Sam- Hide quoted text -
>
> - Show quoted text -
Reply all
Reply to author
Forward
0 new messages