You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@myfaces.apache.org by Mario Ivankovits <ma...@ops.co.at> on 2007/05/21 13:10:56 UTC

datatable and groupBy enhancements

Hi!

I'd like to make the following two enhancements to the tomahawk
datatable/column:

1) add a new attribute "groupByValue" to the column
This allows to configure a valueBinding to be used as value to check if
there is a group change instead of scanning the children.
The old behavior still works, but has the disadvantages that it doesn't
not work if you embed the values in an panelGrid/panelGroup or any other
container.
Say you'll print the customer name in the groupBy column. The
groupByValue will be the id of the customer but the column content is a
panelGrid rendering the name/address etc.

2) use objects instead of StringBuffer to create the compare string
The current implementation uses a StringBuffer to collect all the
children values. This means it has to lookup the converter to convert
the object to a string.
I'd like to change this to use a list of objects and compare them object
by object using .equals(), avoiding the need to use a converter.
Though, this might be an incompatible change as a converter might return
the same string for different object values and where there was no group
change in the past, now it will.
However, I think this case is very unlikely.


What do you think?
Any objections?

Ciao,
Mario


Re: datatable and groupBy enhancements

Posted by Martin Marinschek <ma...@gmail.com>.
Hi Zdenek,

ad 1 - that's exactly what Mario wants to do - he wants to make sure
that the group doesn't change if only an attribute, but not the id
changes.

ad 2 - why does sorting have anything to do with the grouping functionality?

regards,

Martin

On 5/21/07, Zdeněk Sochor <zd...@ataco.cz> wrote:
> Hi,
>   i don't think either of suggestions are right.
>
> Sugesstion 1 has disadvatage:
> if you change one property of children in group, which is not defined as
> groupByValue or
> taken in account when computing value of checking value,
> you don't get whole group as changed.
>
> Suggestion 2 has disadvantage:
> equals() method returns only TWO results - true/false,
> while comparator returns THREE results - -1, 0, 1.
> By using equals() method you can't do sorting on objects :(
>
> Regards,
>   Zdenek
>
> Martin Marinschek napsal(a):
> > No, sounds good to me.
> >
> > regards,
> >
> > Martin
> >
> > On 5/21/07, Mario Ivankovits <ma...@ops.co.at> wrote:
> >> Hi!
> >>
> >> I'd like to make the following two enhancements to the tomahawk
> >> datatable/column:
> >>
> >> 1) add a new attribute "groupByValue" to the column
> >> This allows to configure a valueBinding to be used as value to check if
> >> there is a group change instead of scanning the children.
> >> The old behavior still works, but has the disadvantages that it doesn't
> >> not work if you embed the values in an panelGrid/panelGroup or any other
> >> container.
> >> Say you'll print the customer name in the groupBy column. The
> >> groupByValue will be the id of the customer but the column content is a
> >> panelGrid rendering the name/address etc.
> >>
> >> 2) use objects instead of StringBuffer to create the compare string
> >> The current implementation uses a StringBuffer to collect all the
> >> children values. This means it has to lookup the converter to convert
> >> the object to a string.
> >> I'd like to change this to use a list of objects and compare them object
> >> by object using .equals(), avoiding the need to use a converter.
> >> Though, this might be an incompatible change as a converter might return
> >> the same string for different object values and where there was no group
> >> change in the past, now it will.
> >> However, I think this case is very unlikely.
> >>
> >>
> >> What do you think?
> >> Any objections?
> >>
> >> Ciao,
> >> Mario
> >>
> >>
> >
> >
>
>


-- 

http://www.irian.at

Your JSF powerhouse -
JSF Consulting, Development and
Courses in English and German

Professional Support for Apache MyFaces

Re: datatable and groupBy enhancements

Posted by Mario Ivankovits <ma...@ops.co.at>.
Hi!
> Sugesstion 1 has disadvatage:
> if you change one property of children in group, which is not defined
> as groupByValue or
> taken in account when computing value of checking value,
> you don't get whole group as changed.
Notice, this change is backward compatible, so if you do NOT use
groupByValue you'll get what you have now.
The table will simply scan the children of the groupBy cell.
groupByValue will just give you the control of WHICH property to use to
check the group change condition, you'll do this if you have multiple
children added to a panelGrid (which currently do not work, but I'll
change this too)
> Suggestion 2 has disadvantage:
> equals() method returns only TWO results - true/false,
> while comparator returns THREE results - -1, 0, 1.
> By using equals() method you can't do sorting on objects :(
This would be true if we have to use sorting for this kind of stuff, but
we do not have to. The code was a simple .compareTo()==0, so replacable
by .equals() once we check the objects directly and not their string
representation in an StringBuffer.

Ciao,
Mario


Re: datatable and groupBy enhancements

Posted by Zdeněk Sochor <zd...@ataco.cz>.
Hi,
  i don't think either of suggestions are right.

Sugesstion 1 has disadvatage:
if you change one property of children in group, which is not defined as 
groupByValue or
taken in account when computing value of checking value,
you don't get whole group as changed.

Suggestion 2 has disadvantage:
equals() method returns only TWO results - true/false,
while comparator returns THREE results - -1, 0, 1.
By using equals() method you can't do sorting on objects :(

Regards,
  Zdenek

Martin Marinschek napsal(a):
> No, sounds good to me.
>
> regards,
>
> Martin
>
> On 5/21/07, Mario Ivankovits <ma...@ops.co.at> wrote:
>> Hi!
>>
>> I'd like to make the following two enhancements to the tomahawk
>> datatable/column:
>>
>> 1) add a new attribute "groupByValue" to the column
>> This allows to configure a valueBinding to be used as value to check if
>> there is a group change instead of scanning the children.
>> The old behavior still works, but has the disadvantages that it doesn't
>> not work if you embed the values in an panelGrid/panelGroup or any other
>> container.
>> Say you'll print the customer name in the groupBy column. The
>> groupByValue will be the id of the customer but the column content is a
>> panelGrid rendering the name/address etc.
>>
>> 2) use objects instead of StringBuffer to create the compare string
>> The current implementation uses a StringBuffer to collect all the
>> children values. This means it has to lookup the converter to convert
>> the object to a string.
>> I'd like to change this to use a list of objects and compare them object
>> by object using .equals(), avoiding the need to use a converter.
>> Though, this might be an incompatible change as a converter might return
>> the same string for different object values and where there was no group
>> change in the past, now it will.
>> However, I think this case is very unlikely.
>>
>>
>> What do you think?
>> Any objections?
>>
>> Ciao,
>> Mario
>>
>>
>
>


Re: datatable and groupBy enhancements

Posted by Martin Marinschek <ma...@gmail.com>.
No, sounds good to me.

regards,

Martin

On 5/21/07, Mario Ivankovits <ma...@ops.co.at> wrote:
> Hi!
>
> I'd like to make the following two enhancements to the tomahawk
> datatable/column:
>
> 1) add a new attribute "groupByValue" to the column
> This allows to configure a valueBinding to be used as value to check if
> there is a group change instead of scanning the children.
> The old behavior still works, but has the disadvantages that it doesn't
> not work if you embed the values in an panelGrid/panelGroup or any other
> container.
> Say you'll print the customer name in the groupBy column. The
> groupByValue will be the id of the customer but the column content is a
> panelGrid rendering the name/address etc.
>
> 2) use objects instead of StringBuffer to create the compare string
> The current implementation uses a StringBuffer to collect all the
> children values. This means it has to lookup the converter to convert
> the object to a string.
> I'd like to change this to use a list of objects and compare them object
> by object using .equals(), avoiding the need to use a converter.
> Though, this might be an incompatible change as a converter might return
> the same string for different object values and where there was no group
> change in the past, now it will.
> However, I think this case is very unlikely.
>
>
> What do you think?
> Any objections?
>
> Ciao,
> Mario
>
>


-- 

http://www.irian.at

Your JSF powerhouse -
JSF Consulting, Development and
Courses in English and German

Professional Support for Apache MyFaces

Re: datatable and groupBy enhancements

Posted by Paul Spencer <pa...@apache.org>.
Mario,
I am already thinking of places to use the enhancements.


+1 - add a new attribute "groupByValue" to the column
+1 - use objects instead of StringBuffer to create the compare string

Paul Spencer

Mario Ivankovits wrote:
> Hi!
> 
> I'd like to make the following two enhancements to the tomahawk
> datatable/column:
> 
> 1) add a new attribute "groupByValue" to the column
> This allows to configure a valueBinding to be used as value to check if
> there is a group change instead of scanning the children.
> The old behavior still works, but has the disadvantages that it doesn't
> not work if you embed the values in an panelGrid/panelGroup or any other
> container.
> Say you'll print the customer name in the groupBy column. The
> groupByValue will be the id of the customer but the column content is a
> panelGrid rendering the name/address etc.
> 
> 2) use objects instead of StringBuffer to create the compare string
> The current implementation uses a StringBuffer to collect all the
> children values. This means it has to lookup the converter to convert
> the object to a string.
> I'd like to change this to use a list of objects and compare them object
> by object using .equals(), avoiding the need to use a converter.
> Though, this might be an incompatible change as a converter might return
> the same string for different object values and where there was no group
> change in the past, now it will.
> However, I think this case is very unlikely.
> 
> 
> What do you think?
> Any objections?
> 
> Ciao,
> Mario
> 
>