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

ListView et al: editing location must be -1 if not editable

    XMLWordPrintable

    Details

      Description

      it's not if changing editability while editing, failing tests:

          @Test
          public void testDisableEditableWhileEditingMustTerminateEdit() {
              int editingIndex = 1;
              listView.edit(editingIndex);
              listView.setEditable(false);
              assertEquals(-1, listView.getEditingIndex());
          }
          
          /**
           * test manual edit termination
           */
          @Test
          public void testDisableEditableWhileEditingMustAllowTerminateEdit() {
              int editingIndex = 1;
              listView.edit(editingIndex);
              listView.setEditable(false);
              listView.edit(-1);
              assertEquals(-1, listView.getEditingIndex());
          }

      The list should update its editing state to not-editing on change of editable -> !editable. At the very least, it should be possible to manually update the location to not-editing which is not possible due to edit(..) unconditionally backing out if not editable:

          public void edit(int itemIndex) {
              if (!isEditable()) return;
              setEditingIndex(itemIndex);
          }

      similar for all virtualized controls (not tested yet, but implementation is similar)

        Attachments

          Activity

            People

            Assignee:
            fastegal Jeanette Winzenburg
            Reporter:
            fastegal Jeanette Winzenburg
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated: