You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pivot.apache.org by Michael Villere <Mi...@archlearning.com> on 2010/02/17 20:31:38 UTC

Bug in GridPaneSkin

Hi,

I was writing up some code using GridPanes, and I noticed a bug in GridPaneSkin.java. This looks like a standard copy/paste bug, so my explanation is minimal.

Notice that in the second loop, the if statement checks for (metadata.isRowVisible(...)) instead of (metadata.isColumnVisible(...)).

This bug prevents a GridPane from being used anytime the GridPane does not have an equal number of rows and columns. If the number of rows and columns is equal (ie 3x3 in the demo), then the code works.

                @Override
      public void paint(Graphics2D graphics) {
            ...

            if (showHorizontalGridLines && verticalSpacing > 0 && rowCount > 1) {
                  graphics.setPaint(horizontalGridColor);

                  int rowY = padding.top + (cellHeight + verticalSpacing);

                  for (int i = 1; i < rowCount; i++) {
                        if (metadata.isRowVisible(i - 1)) {
                              ...
                        }
                  }
            }

            if (showVerticalGridLines && horizontalSpacing > 0 && columnCount > 1) {
                  graphics.setPaint(verticalGridColor);

                  int columnX = padding.left + (cellWidth + horizontalSpacing);

                  for (int j = 1; j < columnCount; j++) {
                        if (metadata.isRowVisible(j - 1)) {
                              ...
                        }
                  }
            }
      }
Just bringing this to everyone's attention. Overall, I am pretty excited about using Pivot in my application.

Thanks!
Michael

Michael Villere
Software Developer
Classroom Response System Integration
800.419.3191  x7822

[cid:image001.jpg@01CAAFD5.87AEDFC0]<http://www.archlearning.com/> Archipelago Learning<http://www.archlearning.com/> | STUDY ISLAND<http://www.studyisland.com/> | Northstar Learning<http://www.northstarlearning.com/>


______________________________________________________________________________________________________

The information contained in this electronic message and any attachments is confidential, 
is for the sole use of the intended recipient(s) and may contain privileged information. 
Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the 
intended recipient, you must not read, use or disseminate the information, and should immediately 
contact the sender by reply email and destroy all copies of the original message.


Re: Bug in GridPaneSkin

Posted by Greg Brown <gk...@mac.com>.
Hi Michael,

Good catch. I actually ran into this myself a few weeks ago - this has been fixed for Pivot 1.4.1.

BTW, your message was initially rejected by the mail server - are you subscribed to the dev list?

Thanks,
Greg


On Feb 17, 2010, at 2:31 PM, Michael Villere wrote:

> Hi,
>  
> I was writing up some code using GridPanes, and I noticed a bug in GridPaneSkin.java. This looks like a standard copy/paste bug, so my explanation is minimal.
>  
> Notice that in the second loop, the if statement checks for (metadata.isRowVisible(…)) instead of (metadata.isColumnVisible(…)).
>  
> This bug prevents a GridPane from being used anytime the GridPane does not have an equal number of rows and columns. If the number of rows and columns is equal (ie 3x3 in the demo), then the code works.
>  
>                 @Override
>       public void paint(Graphics2D graphics) {
>             …
>  
>             if (showHorizontalGridLines && verticalSpacing > 0 && rowCount > 1) {
>                   graphics.setPaint(horizontalGridColor);
>  
>                   int rowY = padding.top + (cellHeight + verticalSpacing);
>  
>                   for (int i = 1; i < rowCount; i++) {
>                         if (metadata.isRowVisible(i - 1)) {
>                               …
>                         }
>                   }
>             }
>  
>             if (showVerticalGridLines && horizontalSpacing > 0 && columnCount > 1) {
>                   graphics.setPaint(verticalGridColor);
>  
>                   int columnX = padding.left + (cellWidth + horizontalSpacing);
>  
>                   for (int j = 1; j < columnCount; j++) {
>                         if (metadata.isRowVisible(j - 1)) {
>                               …
>                         }
>                   }
>             }
>       }
> Just bringing this to everyone’s attention. Overall, I am pretty excited about using Pivot in my application.
>  
> Thanks!
> Michael
>  
> Michael Villere
> Software Developer
> Classroom Response System Integration
> 800.419.3191  x7822
>  
> <attachment> Archipelago Learning | STUDY ISLAND | Northstar Learning
>  
> ______________________________________________________________________________________________________
> 
> The information contained in this electronic message and any attachments is confidential, 
> is for the sole use of the intended recipient(s) and may contain privileged information. 
> Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the 
> intended recipient, you must not read, use or disseminate the information, and should immediately 
> contact the sender by reply email and destroy all copies of the original message.
> 
>