-
Bug
-
Resolution: Fixed
-
P4
-
8
-
JDK8 b80, Win7 64bit
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).
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).