TableComparatorChooser.fromString

View: New views
4 Messages — Rating Filter:   Alert me  

TableComparatorChooser.fromString

by Thies Rubarth :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello,

I try restoring the sorting state of my list using the  
TableComparatorChooser's fromString() method. When I do so the sort  
icons in the table header are set correctly, but the lists data stays  
unsorted. Am I missing something?

Best regards

Thies



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...


Re: TableComparatorChooser.fromString

by James Lemieux :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Are you certain that you are not manually altering the Comparator of the SortedList after your call to fromString()? This could account for the discrepancy.

James

On Wed, Sep 9, 2009 at 6:20 AM, Thies Rubarth <thies.rubarth@...> wrote:
Hello,

I try restoring the sorting state of my list using the TableComparatorChooser's fromString() method. When I do so the sort icons in the table header are set correctly, but the lists data stays unsorted. Am I missing something?

Best regards

Thies



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...



Re: TableComparatorChooser.fromString

by Thies Rubarth :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

thank you for you quick reply. I am setting my own comparators directly before I call the fromString method. Here's a snippet from my code...

JTable table = (JTable)getGuiComponent();
this.data = new SortedList<DataListRow>(GlazedLists.eventList(tableData),
   new Comparator<DataListRow>() {
      public int compare(DataListRow o1, DataListRow o2) {
        return 0;
      }
   });
EventTableModel<DataListRow> model =
   new EventTableModel<DataListRow>(this.datadataListTableFormat);
   
if(table!=null){
   table.setModel(model);
   sorter = TableComparatorChooser.install(table, this.data,
      TableComparatorChooser.MULTIPLE_COLUMN_MOUSE_WITH_UNDO);
   int colIdx = 0;
   for(int modelIdx=0; modelIdx <dataListColumnModel.getColumnCount(); modelIdx ++){     
      ListColumnField colField = dataListColumnModel.getColumn(modelIdx);
      if(colField.isVisible()){
         List<Comparator> comparators = sorter.getComparatorsForColumn(colIdx++);
         comparators.clear();
         comparators.add(ComparatorFactory.getInstance().getComparator(colField, modelIdx));
      }          
   }    
}
   
if(profile!=null && sorter!=null){
   sorter.fromString(profile.getGLSortingString());
}


Do you have another idea what might be wrong?

Best regards

Thies

Am 09.09.2009 um 22:54 schrieb James Lemieux:

Are you certain that you are not manually altering the Comparator of the SortedList after your call to fromString()? This could account for the discrepancy.

James

On Wed, Sep 9, 2009 at 6:20 AM, Thies Rubarth <thies.rubarth@...> wrote:
Hello,

I try restoring the sorting state of my list using the TableComparatorChooser's fromString() method. When I do so the sort icons in the table header are set correctly, but the lists data stays unsorted. Am I missing something?

Best regards

Thies



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...




--
Consulting Team 42 Thies Rubarth
Barmbeker Straße 173
22299 Hamburg

Telefon: +4940  555 75 298
Fax: +4940  636 52 663
Mobil: +49176 640 97 980
Email: thies.rubarth@...

Steuernummer: 57/095/06783


Re: TableComparatorChooser.fromString

by Thies Rubarth :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

I'm very sorry, I found the error in our framework. Glazed Lists works  
perfectly :-)

Best regards!

Thies

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...