« Return to Thread: EventListJXTableSorting

EventListJXTableSorting

by Steve Newell :: Rate this Message:

Reply to Author | View in Thread

I am attempting to create a table using JXTable and glazedLists.  My problem is the sorting.  Things seem to work fine UNLESS I call 

EventListJXTableSorting.install( imageTable, sortedList );

When I add that call, the table is not sorted until I select one of the headers.

Here is the method that creates the table:

private JScrollPane getFilteredList()
{
JScrollPane scrollImageTable = null;


imageList.getReadWriteLock().writeLock().lock();
try
{
SortedList< ImageSignature > sortedList = new SortedList< ImageSignature >( imageList, new ImageSizeComparator() );
EventTableModel< ImageSignature > tableModel = new EventTableModel< ImageSignature >( sortedList, new ImageTableFormat() );
JXTable imageTable = new DroppableTable( tableModel );

EventListJXTableSorting sorting = EventListJXTableSorting.install( imageTable, sortedList );
sorting.setMultipleColumnSort( false );

scrollImageTable = new JScrollPane( imageTable );

imageTable.setHighlighters( HighlighterFactory.createAlternateStriping(), new RolloverHighlighter( Color.BLACK, Color.white ) );
imageTable.setRolloverEnabled( true );
imageTable.setHorizontalScrollEnabled( true );

imageTable.setSelectionMode( ListSelectionModel.SINGLE_SELECTION );
imageTable.setColumnControlVisible( true );


TableSelectionListener selectionListener = new TableSelectionListener( imageTable );
imageTable.getSelectionModel().addListSelectionListener( selectionListener );
}
finally
{
imageList.getReadWriteLock().writeLock().unlock();
}


return scrollImageTable;
}

 « Return to Thread: EventListJXTableSorting