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

ListView PlaceHolder is removed only after second item is added to item list

XMLWordPrintable

      Starting with an empty item list for a ListView, the placeholder is removed not after adding the first item. It is necessary to add a second item so that updateRowCount is triggered again.

      Looking at the code it seems like ListViewSkin updateRowCount is calling updatePlaceholderRegionVisibility() before the new itemCount is set, so that the check if itemCount == 0 in updatePlaceholderRegionVisibility(), i.e. visible = getItemCount() == 0 still is false, although an item is already added. Moving the call below itemCount = newCount; seems do the trick for me.

      It could be more efficient to have the updatePlaceholderRegionVisibility() only be called if there is a change in itemCount, but I could not get this to work (some problem with both being 0 already if I remove the last item from the list).

            jgiles Jonathan Giles
            sreimersjfx Sven Reimers (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported: