Yes, this was originally what I was looking for.

-----Original Message-----
From: Paulsen, Jay [mailto:[EMAIL PROTECTED]
Sent: Wednesday, April 02, 2003 11:13 AM
To: [EMAIL PROTECTED]
Subject: RE: [displaytag-user] easy way to sort simple String columns
case-insensitively?


I'm not sure there's a way to do it generically.  It would be nice to be
able to do this in a jsp:

<display:table name="foo">
   <display:column property="bar" sort="true" caseInsensitiveSort="true"/>
</display:table>

and have the table tag automagically take care of it.  Is this what you're
thinking of?






> -----Original Message-----
> From: Ryan Bell [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, April 02, 2003 12:39 PM
> To: [EMAIL PROTECTED]
> Subject: RE: [displaytag-user] easy way to sort simple String columns
> case-insensitively?
> 
> 
> Thanks Jay, the problem I see with this solution is that I 
> have to create a seperate decorator for each object property 
> I want to sort on and we use display tables all over the 
> place where we need to be able to sort Strings like this.  
> Since sorting strings case-insensitively is such a common 
> thing I was hoping that there was functionality in the tag to 
> handle this without that much work (or maybe I'm just being 
> lazy).  Is there a way to pass a property name in when using 
> a decorator (other than the decorator property name) so I 
> could create a generic decorator of this type?
> 
> Ryan
> 
> -----Original Message-----
> From: Paulsen, Jay [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, April 02, 2003 6:35 AM
> To: [EMAIL PROTECTED]
> Subject: RE: [displaytag-user] easy way to sort simple String columns
> case-insensitively?
> 
> 
> You can't subclass String because it's final.  But you can 
> create a String
> wrapper class that implements Comparable and perform your 
> case insensitive
> compare there.  Then, in a decorator, return an instance of 
> this wrapper
> class.
> 
> Don't know if this is the best way - but it is functional.
> 
> example:
> 
> 
> /* String wrapper class to implement case insensitive sorting */
> public class CaseInsensitiveString implements Serializable, 
> Comparable {
>   private String s;
> 
>   public CaseInsensitiveString(String s) {
>     this.s = s;
>   }
> 
>   public String toString() {
>     return s.toString();
>   }
> 
>   public int compareTo(Object o) {
>     // ignore case on compare
>     return this.s.compareToIgnoreCase(((CaseInsensitiveString) o).s);
>   }
> }
> 
> 
> /* decorator */
> public class MyDecorator extends TableDecorator {
>  
>   public CaseInsensitiveString getMyString() {
>     // build a case insensitive string object to wrap the string
> representation
>     // of your object or object property as needed
>     return new CaseInsensitiveString(((MyObject)
> getObject()).getSomeProperty());
>   }
> }
> 
> HTH
> -Jay
> 
> 
> > -----Original Message-----
> > From: Ryan Bell [mailto:[EMAIL PROTECTED]
> > Sent: Tuesday, April 01, 2003 5:20 PM
> > To: [EMAIL PROTECTED]
> > Subject: [displaytag-user] easy way to sort simple String columns
> > case-insensitively?
> > 
> > 
> > I've looked through the information at 
> > http://edhill.its.uiowa.edu/display/ and saw no easy way to 
> > get a sort of a column of strings case-insensitive in the 
> > display tag.  I'm not talking about the initial sorting but 
> > the sort once a column that is sortable is clicked.  Is there 
> > an easier way to do this than subclassing String and 
> > overriding the compareTo method?
> > 
> > Thanks,
> > Ryan
> > 
> > 
> > -------------------------------------------------------
> > This SF.net email is sponsored by: ValueWeb: 
> > Dedicated Hosting for just $79/mo with 500 GB of bandwidth! 
> > No other company gives more support or power for your 
> dedicated server
> > http://click.atdmt.com/AFF/go/sdnxxaff00300020aff/direct/01/
> > _______________________________________________
> > displaytag-user mailing list
> > [EMAIL PROTECTED]
> > https://lists.sourceforge.net/lists/listinfo/displaytag-user
> > 
> 
> 
> -------------------------------------------------------
> This SF.net email is sponsored by: ValueWeb: 
> Dedicated Hosting for just $79/mo with 500 GB of bandwidth! 
> No other company gives more support or power for your dedicated server
> http://click.atdmt.com/AFF/go/sdnxxaff00300020aff/direct/01/
> _______________________________________________
> displaytag-user mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/displaytag-user
> 
> 
> -------------------------------------------------------
> This SF.net email is sponsored by: ValueWeb: 
> Dedicated Hosting for just $79/mo with 500 GB of bandwidth! 
> No other company gives more support or power for your dedicated server
> http://click.atdmt.com/AFF/go/sdnxxaff00300020aff/direct/01/
> _______________________________________________
> displaytag-user mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/displaytag-user
> 


-------------------------------------------------------
This SF.net email is sponsored by: ValueWeb: 
Dedicated Hosting for just $79/mo with 500 GB of bandwidth! 
No other company gives more support or power for your dedicated server
http://click.atdmt.com/AFF/go/sdnxxaff00300020aff/direct/01/
_______________________________________________
displaytag-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/displaytag-user


-------------------------------------------------------
This SF.net email is sponsored by: ValueWeb:
Dedicated Hosting for just $79/mo with 500 GB of bandwidth!
No other company gives more support or power for your dedicated server
http://click.atdmt.com/AFF/go/sdnxxaff00300020aff/direct/01/
_______________________________________________
displaytag-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/displaytag-user

Reply via email to