« Return to Thread: EventListJXTableSorting

Re: EventListJXTableSorting

by Steve Newell :: Rate this Message:

Reply to Author | View in Thread

Actually, my list IS initially sorted, which is what I expected.  I thought that since I was passing the sortedList to my EventTableModel, it would sort initially.  Is that not correct?

My application creates a list of images and displays them in the JXTable.  I would like the image list to be sorted by size initially.  That is what happens when I don't call EventListJXTableSorting.install( ... ).

Also, if I add a FilterList to the table, everything appears to work until I change the filter.  Once the I change the filter, I only get one entry, no matter what else I try.


James Lemieux wrote:
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@gmail.com> 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