« Return to Thread: EventListJXTableSorting

Re: EventListJXTableSorting

by James Lemieux :: Rate this Message:

Reply to Author | View in Thread

Steve,

   I'm unsure of what your exact problem is. In GL, tables stay unsorted until you click on the header once. We don't have the concept of a default table order (yet). What is incorrect about not sorting the table until the header is clicked?

James

On 7/25/07, Steve Newell <newellista@...> wrote:
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