Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-5033178

REGRESSION: ListSelectionEvent thrown within DefaultTableColumnModel.moveColumn

    XMLWordPrintable

Details

    Backports

      Description

        Name: gm110360 Date: 04/16/2004


        FULL PRODUCT VERSION :
        java version "1.4.2"
        Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2-b28)
        Java HotSpot(TM) Client VM (build 1.4.2-b28, mixed mode)


        FULL OS VERSION :
        Windows NT Version 4.0 ( Service Pack 6)

        A DESCRIPTION OF THE PROBLEM :
        Since JDK 1.4 method moveColumn of DefaultTabelColumnModel calls DefaultListSelectionModel.removeSelectionInterval, when unselected columns are moved in the DefaultTableColumnModel.
        The DefaultListSelectionModel fires an event ValueChanged although no selection has really changed by the moveColumn operation.

        STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
        Start the application CustomJTable from the example beneath.










        EXPECTED VERSUS ACTUAL BEHAVIOR :
        EXPECTED -
        Method valueChanged of the ListSelectionListener should not be called.
        ACTUAL -
        Method valueChanged of the ListSelectionListener is called.

        REPRODUCIBILITY :
        This bug can be reproduced always.

        ---------- BEGIN SOURCE ----------
        import javax.swing.JTable;
        import javax.swing.table.*;
        import javax.swing.event.*;

        public class CustomJTable extends JTable {

        public static void main (String[] args) {
        CustomJTable table = new CustomJTable();
        table.moveCol();
        }

        public void moveCol() {

        TableColumnModel columnModel = new DefaultTableColumnModel();
        TableColumn columnA = new TableColumn();
        columnModel.addColumn(columnA);
        TableColumn columnB = new TableColumn();
        columnModel.addColumn(columnB);
        setColumnModel(columnModel);
        ListSelectionListener listener = this.new CustomListSelectionListener();
        columnModel.getSelectionModel().addListSelectionListener(listener);

        columnModel.moveColumn(0,1);
        }

        public class CustomListSelectionListener implements ListSelectionListener {
        public void valueChanged(ListSelectionEvent e) {
        System.out.println(e);
        }
        }
        }

        ---------- END SOURCE ----------

        Release Regression From : 1.3.1_11
        The above release value was the last known release where this
        bug was known to work. Since then there has been a regression.

        (Incident Review ID: 193391)
        ======================================================================

        Attachments

          Issue Links

            Activity

              People

                Unassigned Unassigned
                gmanwanisunw Girish Manwani (Inactive)
                Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                  Created:
                  Updated:
                  Resolved:
                  Imported:
                  Indexed: