classpath-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [cp-patches] FYI: BasicListUI fix


From: Mark Wielaard
Subject: Re: [cp-patches] FYI: BasicListUI fix
Date: Thu, 05 Jan 2006 09:05:33 +0100

Hi,

On Wed, 2006-01-04 at 21:40 +0000, Roman Kennke wrote:
> 2006-01-04  Roman Kennke  <address@hidden>
> 
>         * javax/swing/plaf/basic/BasicListUI.java
>         (locationToIndex): Added FIXME about getVisibleRowCount() usage.
>         Adjusted iteration to not use visibleRowCount and instead iterate
>         over the real number of elements in cellHeights.
>         (indexToLocation): Added FIXME about getVisibleRowCount() usage.
>         Adjusted iteration to not use visibleRowCount and instead iterate
>         over the real number of elements in cellHeights.
> [...]
@@ -1189,6 +1189,9 @@
         break;
       case JList.HORIZONTAL_WRAP:
         // determine visible rows and cells per row
+        // FIXME: We really should not use getVisibleRowCount() here. Please
+        // refer to the (Sun) API docs of JList.setVisibleRowCount() for
+        // details.
         int visibleRows = list.getVisibleRowCount();
         int cellsPerRow = -1;
         int numberOfItems = list.getModel().getSize();

That is a bit obscure comment. I think you refer to the fact that
getVisibleRowCount() doesn't give the actual visible rows, but only the
preferred number of rows. We do document that, but only as part of the
property, which isn't visible in the public docs since it is package
private:

  /**
   * This property indicates a <em>preference</em> for the number of rows
   * displayed in the list, and will scale the
   * address@hidden #getPreferredScrollableViewportSize} property accordingly. 
The actual
   * number of displayed rows, when the list is placed in a real address@hidden
   * JViewport} or other component, may be greater or less than this number.
   */
  int visibleRowCount;

We probably should move this documentation to the getter and setter
method or the class documentation to more prominently explain this.

BTW, what is the correct fix? You could get the viewPort and try to
deduce the number of rows from that I guess.

Cheers,

Mark

Attachment: signature.asc
Description: This is a digitally signed message part


reply via email to

[Prev in Thread] Current Thread [Next in Thread]