glazedlists
  1. glazedlists
  2. GLAZEDLISTS-464

TableComparatorChooser & wrong selection

    Details

    • Type: Bug Bug
    • Status: Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: current
    • Fix Version/s: milestone 1
    • Component/s: swing
    • Labels:
      None
    • Environment:

      Operating System: All
      Platform: All

    • Issuezilla Id:
      464

      Description

      Bugreport from user list:
      https://glazedlists.dev.java.net/servlets/ReadMsg?list=users&msgNo=3726

      "I'm using the TableComparatorChooser to sort my rows and stumbled upon an
      annoying issue. The selection stays when sorting, but when using the arrow
      keys to navigate to the next/previous row, the first row of the table is
      selected instead of the next/previous row of the current selection. I've
      noticed that when sorting the rows, the anchor/lead selection index is set
      to -1 which causes this incorrect behaviour. It seems that the selection
      model's state is incorrect. Having a selection without anchor or lead
      indexes looks wrong in my humble understanding of the swing table model."

      I've added a test case for this problem:
      EventTableModelTest.guiTestChangeSelectionByKeysInSortedState_FixMe()

        Activity

        Hide
        brianmerrill added a comment -

        Created an attachment (id=47)
        Proposed patch (generated via Eclipse) to track changes to the lead and anchor indices by way of the reorder map to preserve keyboard selections.

        Show
        brianmerrill added a comment - Created an attachment (id=47) Proposed patch (generated via Eclipse) to track changes to the lead and anchor indices by way of the reorder map to preserve keyboard selections.
        Hide
        brianmerrill added a comment -

        The above patch also contains an update to the JUnit test case for this issue,
        i.e. "guiTestChangeSelectionByKeysInSortedState_FixMe". The test case checked
        for a lead selection of -1 when it should be a value > 0 based upon the previous
        setSelectionInterval(1, 1) call.

        Show
        brianmerrill added a comment - The above patch also contains an update to the JUnit test case for this issue, i.e. "guiTestChangeSelectionByKeysInSortedState_FixMe". The test case checked for a lead selection of -1 when it should be a value > 0 based upon the previous setSelectionInterval(1, 1) call.
        Hide
        brianmerrill added a comment -

        Or rather, the lead selection should be a value greater than or equal to zero
        but not negative.

        Show
        brianmerrill added a comment - Or rather, the lead selection should be a value greater than or equal to zero but not negative.

          People

          • Assignee:
            jessewilson
            Reporter:
            brands
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated: