Add Internationalised support to SortableTable

This forum is used by users to request and discuss new product features. Please do not use this forum for technical support including bug reports.

Moderator: JIDE Support

Forum rules
Product suggestions only. Please do not use this forum for technical support including bug reports.

Add Internationalised support to SortableTable

Postby arazvi » Fri Oct 21, 2005 1:43 am

Can you provide an overloaded SortableTable constructor that accepts a collator to provide language specific sorting, please ? This is one of the requirements holding up the purchase of the JideSoft suite by our company.

For example,

public SortableTable(TableModel tm, Collator c)

which could then be used like this:

TableModel t = new MyTableModel();
Collator c = Collator.getInstance(Locale.FRANCE);
SortableTable s = new Sortable(t, c);

regards, Asad.
arazvi
 
Posts: 27
Joined: Mon Sep 05, 2005 4:07 am

Postby JIDE Support » Fri Oct 21, 2005 8:16 am

Right now we use Comparator to do the compaision. All default comparators are defined in ObjectComparatorManager. You can also register your own comparator include Collator. The ObjectComparatorManager can be looked up by the type and a context. TableModel can provide them by getColumnClass() and getColumnComparatorContext() (SortableTableModel only) respectively. Would this be good enough for you? If you can think of anything that can make the use of Collator even easier, I would like to add it too.

Thanks,
JIDE Software Technical Support Team
JIDE Support
Site Admin
 
Posts: 33068
Joined: Sun Sep 14, 2003 10:49 am

Postby JIDE Support » Tue Oct 25, 2005 10:20 pm

I didn't see reponse from you. Does my suggest work or you need more help from us?

Thanks,
JIDE Software Technical Support Team
JIDE Support
Site Admin
 
Posts: 33068
Joined: Sun Sep 14, 2003 10:49 am

Postby arooaroo » Sun Sep 10, 2006 6:25 pm

JIDE Support wrote:Right now we use Comparator to do the compaision. All default comparators are defined in ObjectComparatorManager. You can also register your own comparator include Collator. The ObjectComparatorManager can be looked up by the type and a context. TableModel can provide them by getColumnClass() and getColumnComparatorContext() (SortableTableModel only) respectively. Would this be good enough for you? If you can think of anything that can make the use of Collator even easier, I would like to add it too.

Thanks,


I too require the use of Collators for the sort order. Whilst I'm happy that you suggest that we can use our own comparators, I found your reply too difficult too follow.

Is it possible to give a slightly expanded version? Some pseudo-code, perhaps, in order to aid my understaninding of the proposed solution.

Many thanks
arooaroo
 
Posts: 7
Joined: Wed May 25, 2005 2:37 pm
Location: London, UK

Postby JIDE Support » Sun Sep 10, 2006 7:23 pm

Here are the steps.

1. Register the comparators.
Code: Select all
       
ObjectComparatorManager.initDefaultComparator();
ObjectComparatorManager.registerComparator(String.class, new MyComparator(), new ComparatorContext("MyComparator"));


2. Here is how you define SortableTableModel. Note the two methods.

Code: Select all
class MySortableTableModel {
...

    public class getColumnClass(int index) {
        if(index == the special column index) {
              return String.class;
        }
        else {
...
        }
    }
    protected ComparatorContext getColumnComparatorContext(int column) {
        if(index == the special column index) {
                return new ComparatorContext("MyComparator"); // better define a constant for it
        }
        else return null;
    }
...
}


Thanks,
JIDE Software Technical Support Team
JIDE Support
Site Admin
 
Posts: 33068
Joined: Sun Sep 14, 2003 10:49 am

Postby arooaroo » Tue Sep 12, 2006 6:22 am

Many thanks! This really helps.
arooaroo
 
Posts: 7
Joined: Wed May 25, 2005 2:37 pm
Location: London, UK

Re: Add Internationalised support to SortableTable

Postby suar » Thu Feb 23, 2012 9:00 am

Hello,

I face the same problem. I need to add collator sorting to my SortableTable. I created MySortableTableModel class, which extends SortableTableModel, but mySortableTable.getModel() returns instance of SortableTableModel and not instance of MySortableTableModel. How can i change mySortableTable.getModel() to return instance of MySortableTableModel?

Thank you
suar
 
Posts: 2
Joined: Wed Feb 22, 2012 1:06 am

Re: Add Internationalised support to SortableTable

Postby JIDE Support » Thu Feb 23, 2012 10:06 am

Do you create a SortableTable like this?
Code: Select all
       SortableTable table = new SortableTable(new MySortableTableModel(model));

If yes, the table.getModel() should return MySortableTableModel instance.
JIDE Software Technical Support Team
JIDE Support
Site Admin
 
Posts: 33068
Joined: Sun Sep 14, 2003 10:49 am

Re: Add Internationalised support to SortableTable

Postby suar » Wed Feb 29, 2012 12:24 am

Thank you, issue solved.
suar
 
Posts: 2
Joined: Wed Feb 22, 2012 1:06 am


Return to Product Suggestions

Who is online

Users browsing this forum: No registered users and 1 guest

cron