SortableTable with ContiguousCellSelection and selection

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.

SortableTable with ContiguousCellSelection and selection

Postby nicola.gioia » Mon Oct 23, 2006 6:12 am

If i use a SortableTable and i select a specific cell (for example the cell [2,3]) ant then I sort the table on a column (for example the column 0) the table is correctly sorted, and the table scroll to make visible the correct cell (that could be in position[430,2] for example), but the cell selected displayed on the table remains the cell in position [2,3].

Other problems occour if multiple value are selected:
1) If I select first the cell [2,3] and then the cell [4,5] the cell that is always visible after resorting is the cell [2,3], but if i click on the cell [2,3] anymore to get it the anchor then the table don't scroll at the end of the sort process.
2) If I disable the ContiguousCellSelection (pressing the F2 key on the example) and I select two or more rows, after the sorting the cell are correctly displayed (the row marked as selected are the right rows). The only question here is: why is displayed always the row selected with lowest row index? I think it's better to display the row with anchor. (Example to better understand: I select the row 2, 9, and 6. The row with anchor is the row 6. On ascending order is displayed the row that was in position 2, in the descending order is displayed the row that was in position 9)


The code to reproduce the problem is:

Code: Select all
import java.awt.event.*;

import javax.swing.*;
import javax.swing.table.AbstractTableModel;

import com.jidesoft.grid.SortableTable;
import com.jidesoft.swing.JideSwingUtilities;

public class JideSortTableBug {
   public static void main(String[] args) {
      JFrame d = new JFrame("JideSortTableBug");
      SortableTable t = new SortableTable(new MyTableModel());
      t.setNonContiguousCellSelection(true);
      t.addKeyListener(new KeyAdapter(){
         @Override
         public void keyPressed(KeyEvent e) {
            if(e.getKeyCode()==KeyEvent.VK_F2){
               SortableTable src = (SortableTable) e.getSource();
               src.setNonContiguousCellSelection(!src.isNonContiguousCellSelection());
               System.out.println("nonContiguousCellselection "+(src.isNonContiguousCellSelection()?"enabled":"disabled"));
            }
         }
      });
      d.setContentPane(new JScrollPane(t));
      d.pack();
      JideSwingUtilities.globalCenterWindow(d);
      d.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
      d.setVisible(true);
   }

   protected static class MyTableModel extends AbstractTableModel {
      public int getRowCount() {
         return 10000;
      }
      public int getColumnCount() {
         return 9;
      }

      public boolean isCellEditable(int rowIndex, int columnIndex) {
         return false;
      }

      public Object getValueAt(int rowIndex, int columnIndex) {
         return "" + rowIndex + "," + columnIndex;
      }
   }
}
nicola.gioia
 
Posts: 60
Joined: Tue Sep 20, 2005 6:57 am

Postby JIDE Support » Mon Oct 23, 2006 8:00 am

We reproduced it and will fix it. The reason is we restore the selection after sorting but only the default table selection, not the non-contiguous selection.

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

Postby JIDE Support » Mon Oct 23, 2006 11:49 pm

Just so you know, this bug is fixed in 1.9.3.04 we just released.

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


Return to Product Suggestions

Who is online

Users browsing this forum: No registered users and 95 guests