You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pivot.apache.org by rw...@apache.org on 2013/05/06 18:06:24 UTC

svn commit: r1479613 - in /pivot/branches/2.0.x/wtk/src/org/apache/pivot/wtk: Viewport.java skin/ScrollPaneSkin.java

Author: rwhitcomb
Date: Mon May  6 16:06:24 2013
New Revision: 1479613

URL: http://svn.apache.org/r1479613
Log:
PIVOT-905:  Address two outstanding issues with the workaround for painting
problems during scrolling:
1) The Javadoc for Viewport "repaintAllViewport" property is backwards, and
   lacks some detail.
2) There is no code to implement this workaround for horizontal scrolling
   (as there is for vertical scroll).

Modified:
    pivot/branches/2.0.x/wtk/src/org/apache/pivot/wtk/Viewport.java
    pivot/branches/2.0.x/wtk/src/org/apache/pivot/wtk/skin/ScrollPaneSkin.java

Modified: pivot/branches/2.0.x/wtk/src/org/apache/pivot/wtk/Viewport.java
URL: http://svn.apache.org/viewvc/pivot/branches/2.0.x/wtk/src/org/apache/pivot/wtk/Viewport.java?rev=1479613&r1=1479612&r2=1479613&view=diff
==============================================================================
--- pivot/branches/2.0.x/wtk/src/org/apache/pivot/wtk/Viewport.java (original)
+++ pivot/branches/2.0.x/wtk/src/org/apache/pivot/wtk/Viewport.java Mon May  6 16:06:24 2013
@@ -213,19 +213,26 @@ public abstract class Viewport extends C
     }
 
     /**
-     * Tell if the viewport mode is optimized (repaint only needed area, default), or repaint all
+     * Tell if the viewport painting mode is optimized (repaint only needed area, default), or repaint all.
+     * <p> This is implemented as a workaround for various painting issues on some platforms.
+     * So, if you experience problems with the scrolled-in area not being painted properly
+     * by default, consider setting this property <tt>true</tt> using the
+     * {@link #setRepaintAllViewport setRepaintAllViewport} method.
      *
-     * @return true if optimized, otherwise false
+     * @return <tt>false</tt> if optimized, otherwise <tt>true</tt> (repaint entire viewport)
      */
     public boolean isRepaintAllViewport() {
         return repaintAllViewport;
     }
 
     /**
-     * Set the viewport mode
+     * Set the viewport painting mode.
+     * <p> This is implemented as a workaround for various painting issues on some platforms.
+     * So, if you experience problems with the scrolled-in area not being painted properly
+     * by default, consider setting this property <tt>true</tt> (default is <tt>false</tt>).
      *
      * @param repaintAllViewport
-     * true means optimized (repaint only needed area, default), while false means repaint all
+     * <tt>false</tt> means optimized (repaint only needed area, default), while <tt>true</tt> means repaint all
      */
     public void setRepaintAllViewport(boolean repaintAllViewport) {
         this.repaintAllViewport = repaintAllViewport;

Modified: pivot/branches/2.0.x/wtk/src/org/apache/pivot/wtk/skin/ScrollPaneSkin.java
URL: http://svn.apache.org/viewvc/pivot/branches/2.0.x/wtk/src/org/apache/pivot/wtk/skin/ScrollPaneSkin.java?rev=1479613&r1=1479612&r2=1479613&view=diff
==============================================================================
--- pivot/branches/2.0.x/wtk/src/org/apache/pivot/wtk/skin/ScrollPaneSkin.java (original)
+++ pivot/branches/2.0.x/wtk/src/org/apache/pivot/wtk/skin/ScrollPaneSkin.java Mon May  6 16:06:24 2013
@@ -1109,8 +1109,15 @@ public class ScrollPaneSkin extends Cont
                 scrollPane.setConsumeRepaint(false);
             }
 
-            scrollPane.repaint(rowHeaderWidth + (deltaScrollLeft > 0 ? blitWidth : 0), blitY,
-                Math.abs(deltaScrollLeft), blitHeight, true);
+            boolean repaintAllViewport = scrollPane.isRepaintAllViewport();
+            if (!repaintAllViewport) {
+                scrollPane.repaint(rowHeaderWidth + (deltaScrollLeft > 0 ? blitWidth : 0), blitY,
+                    Math.abs(deltaScrollLeft), blitHeight, true);
+            } else {
+                Bounds viewportBounds = getViewportBounds();
+                scrollPane.repaint(viewportBounds.x, viewportBounds.y,
+                    viewportBounds.width, viewportBounds.height, true);
+            }
         } else {
             if (view != null) {
                 view.setLocation(rowHeaderWidth - scrollLeft, view.getY());